Django不会从Docker开始

Docker启动我的django服务器,并说它在0.0.0.0:8000,但我不能达到它在我的浏览器,0.0.0.0:8000也不127.0.0.1:8000工作

web_1 | You have unapplied migrations; your app may not work properly until they are applied. web_1 | Run 'python manage.py migrate' to apply them. web_1 | April 30, 2017 - 03:36:35 web_1 | Django version 1.8.5, using settings 'my_project.settings' web_1 | Starting development server at http://0.0.0.0:8000/ web_1 | Quit the server with CONTROL-C. 

Dockerfile

 version: '2' services: db: image: postgres web: build: . command: python3 manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - "8000:8000" depends_on: - db 

您是否已将主机上的端口映射到容器上的端口8000? 例如,您可以在--publish 1234:8000 docker run命令中指定--publish 1234:8000将主机端口1234映射到容器端口8000,然后通过http://localhost:1234/访问它。