docker run -it -p 127.0.0.1::2368 ghost bashdocker ps -a
adolph@geek:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
84802ccaa8f7 ghost:latest "/entrypoint.sh bash 32 seconds ago Up 31 seconds 127.0.0.1:32769->2368/tcp kickass_bell
adolph@geek:~$
在浏览器输入localhost:32769后无法连接到资源
想知道到底是哪里除了问题?
shell#build ghost image FROM adolphlwq/ubuntu:14.04_64_base_image MAINTAINER adolphlwqENV REFRESHED_AT 2015-6-9 RUN apt-get update && apt-get -yqq upgrade #install node RUN apt-get install -yqq nodejs npm wget unzip RUN ln -s /usr/bin/nodejs /usr/bin/node #install ghost-zh RUN cd /opt/ && wget http://dl.ghostchina.com/Ghost-0.6.3-zh-full.zip && unzip -uo Ghost-0.6.3-zh-full.zip -d ghost && rm Ghost-0.6.3-zh-full.zip #initial ghost RUN cd /opt/ghost && npm install --production #workdir WORKDIR /opt/ghost/ #expose port 2368 EXPOSE 2368 CMD npm start
然后我又看了Daocloud上ghost的镜像Dockerfile,核心的地方是类似的,不知道我的问题出在哪,端口映射一直失败
daocloud上ghost的Dockerfile
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
竟然没有人回答,我也是碰到相同的问题,自己做的nginx镜像,Dockerfile中也有EXPOSE一个端口,run镜像时,即使没有使用-p参数也一样可以通过宿主机的IP访问到镜像的服务,而指定-p参数打开端口映射时无一生效。mark一下,我先去找找答案