我正在使用
构建我的节点应用程序docker build -t myrepo/myapp .
稍后我正在使用此命令
运行docker run -d --name myapp -p 8000:8000 -t myrepo/myapp
现在我正在检查我这样做
docker ps -a
我正在获得这样的输出
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7fa5bbaebc0b myrepo/myapp "supervisord -c /e..." 6 seconds ago Up 5 seconds 0.0.0.0:8000->8000/tcp myapp
以后我使用公共IP访问应用程序,如PUBLIC_IP:8000但没有出现
Dockerfile
:
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf", "-n"]
我在远程服务器上的curl输出:
curl -v 0.0.0.0:8000
* Rebuilt URL to: 0.0.0.0:8000/
* Trying 0.0.0.0...
* Connected to 0.0.0.0 (127.0.0.1) port 8000 (#0) > GET / HTTP/1.1 > Host: 0.0.0.0:8000 > User-Agent: curl/7.47.0 > Accept: */* >
* Empty reply from server
* Connection #0 to host 0.0.0.0 left intact curl: (52) Empty reply from server
supervisord.conf
[program:myapp]
command=node index.js
directory=/app
autostart=true
autorestart=true
environment=NODE_ENV=production
stderr_logfile=/var/log/atlas.err.log
stdout_logfile=/var/log/atlas.out.log