我已将EXPOSE添加到ASPNET Dockerfile并从中构建图像,但是在docker文件中公开的端口始终是关闭的?我是否需要下载特定的软件包以允许在此映像上打开端口。
Dockerfile
FROM debian:jessie
ENV DNX_VERSION 1.0.0-beta8
ENV DNX_USER_HOME /opt/dnx
RUN apt-get -qq update && apt-get -qqy install unzip curl libicu-dev libunwind8 gettext libssl-dev libcurl3-gnutls zlib1g && rm -rf /var/lib/apt/lists/*
RUN curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_USER_HOME=$DNX_USER_HOME DNX_BRANCH=v$DNX_VERSION sh
RUN bash -c "source $DNX_USER_HOME/dnvm/dnvm.sh \
&& dnvm install $DNX_VERSION -alias default -r coreclr \
&& dnvm alias default | xargs -i ln -s $DNX_USER_HOME/runtimes/{} $DNX_USER_HOME/runtimes/default"
# Install libuv for Kestrel from source code (binary is not in wheezy and one in jessie is still too old)
# Combining this with the uninstall and purge will save us the space of the build tools in the image
RUN LIBUV_VERSION=1.4.2 \
&& apt-get -qq update \
&& apt-get -qqy install autoconf automake build-essential libtool \
&& curl -sSL https://github.com/libuv/libuv/archive/v${LIBUV_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \
&& cd /usr/local/src/libuv-$LIBUV_VERSION \
&& sh autogen.sh && ./configure && make && make install \
&& rm -rf /usr/local/src/libuv-$LIBUV_VERSION \
&& ldconfig \
&& apt-get -y purge autoconf automake build-essential libtool \
&& apt-get -y autoremove \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 5003
ENV PATH $PATH:$DNX_USER_HOME/runtimes/default/bin
请注意暴露像mongodb和nginx等端口的其他图像工作正常,其暴露的端口是打开的。这只是我正在努力的图像
docker检查输出
[
{
"Id": "46865fae677bc52a8d7affbd53d8ed3da941fd2d8276514dcbcdebfc3b5d666a",
"Created": "2015-11-09T10:59:21.613690009Z",
"Path": "/bin/bash",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 21337,
"ExitCode": 0,
"Error": "",
"StartedAt": "2015-11-09T10:59:21.800924128Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "2e1b81c113a2a2ba84935be470f9b02ee22f23649136d4408f0340f385e67fc1",
"ResolvConfPath": "/var/lib/docker/containers/46865fae677bc52a8d7affbd53d8ed3da941fd2d8276514dcbcdebfc3b5d666a/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/46865fae677bc52a8d7affbd53d8ed3da941fd2d8276514dcbcdebfc3b5d666a/hostname",
"HostsPath": "/var/lib/docker/containers/46865fae677bc52a8d7affbd53d8ed3da941fd2d8276514dcbcdebfc3b5d666a/hosts",
"LogPath": "/var/lib/docker/containers/46865fae677bc52a8d7affbd53d8ed3da941fd2d8276514dcbcdebfc3b5d666a/46865fae677bc52a8d7affbd53d8ed3da941fd2d8276514dcbcdebfc3b5d666a-json.log",
"Name": "/aspnet",
"RestartCount": 0,
"Driver": "aufs",
"ExecDriver": "native-0.2",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": [
"181b80dd7744fa16f6e720234c9a9d629b4558cfe84c6e43067f827125a78915"
],
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LxcConf": [],
"Memory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"KernelMemory": 0,
"CpuShares": 0,
"CpuPeriod": 0,
"CpusetCpus": "",
"CpusetMems": "",
"CpuQuota": 0,
"BlkioWeight": 0,
"OomKillDisable": false,
"MemorySwappiness": -1,
"Privileged": false,
"PortBindings": {},
"Links": null,
"PublishAllPorts": false,
"Dns": null,
"DnsOptions": null,
"DnsSearch": null,
"ExtraHosts": null,
"VolumesFrom": null,
"Devices": [],
"NetworkMode": "default",
"IpcMode": "",
"PidMode": "",
"UTSMode": "",
"CapAdd": null,
"CapDrop": null,
"GroupAdd": null,
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"SecurityOpt": null,
"ReadonlyRootfs": false,
"Ulimits": null,
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"CgroupParent": "",
"ConsoleSize": [
0,
0
],
"VolumeDriver": ""
},
"GraphDriver": {
"Name": "aufs",
"Data": null
},
"Mounts": [],
"Config": {
"Hostname": "46865fae677b",
"Domainname": "",
"User": "",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"ExposedPorts": {
"5003/tcp": {}
},
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/dnx/runtimes/default/bin",
"DNX_VERSION=1.0.0-beta8",
"DNX_USER_HOME=/opt/dnx"
],
"Cmd": [
"/bin/bash"
],
"Image": "aspnet:try1",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {},
"StopSignal": "SIGTERM"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "b4d6098c499133f57a7bf90c22cc78f603a4857b7baeba652358e8c825564f16",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"5003/tcp": null
},
"SandboxKey": "/var/run/docker/netns/b4d6098c4991",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "48fd94eabaed4216f1f617f046c1495a77f349c163b4bd8e81f2c7c879968d64",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:04",
"Networks": {
"bridge": {
"EndpointID": "48fd94eabaed4216f1f617f046c1495a77f349c163b4bd8e81f2c7c879968d64",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.4",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:04"
}
}
}
}
]
nmap端口扫描5003
nmap -p 5003 172.17.0.4
Starting Nmap 6.40 ( http://nmap.org ) at 2015-11-09 06:51 EST
Nmap scan report for 172.17.0.4
Host is up (0.00011s latency).
PORT STATE SERVICE
5003/tcp closed filemaker
MAC Address: 02:42:AC:11:00:04 (Unknown)
Nmap done: 1 IP address (1 host up) scanned in 0.46 seconds