我已经单独通过Dockerfile把一个个镜像测试过了,然后现在每个镜像都是可以单独启动的,那么我通过docker-compose up [-d]的方式把我这几个镜像的通过docker-compose.yml给拉起来,比如原来我要一个一个的启动很麻烦,现在可以一次性给拉起来了;
1 2 3 4 5 6 7 8 9 10 11
(base) lyx@h9:~$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE 114_uwsgi_django v1 e529aef73a6b 2 hours ago 8.62GB 114_nginx v1 f8b8ed535b64 2 days ago 198MB 114_nginx v2 f8b8ed535b64 2 days ago 198MB 114_redis v1 614e3bc05a87 5 days ago 169MB redis 6.2 48da0c367062 2 weeks ago 113MB redis latest 3358aea34e8c 2 weeks ago 117MB nginx latest 88736fe82739 2 weeks ago 142MB python 3.6 54260638d07c 11 months ago 902MB (base) lyx@h9:~$
在docker-compose.yml的路径下,执行该句docker-compose up -d命令,其中-d代表后台启动
1 2 3 4 5 6 7 8 9 10 11
(base) lyx@h9:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES (base) lyx@h9:/data/sdb2/lyx/114-query-system-dependencies/docker$ docker-compose up -d Starting docker_Redis_1 ... done Starting docker_uWSGI_Django_1 ... done Starting docker_NGINX_1 ... done (base) lyx@h9:/data/sdb2/lyx/114-query-system-dependencies/docker$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1940658e33e1 114_nginx:v1 "/docker-entrypoint.…" About an hour ago Up 22 seconds 80/tcp, 0.0.0.0:8082->8082/tcp, :::8082->8082/tcp docker_NGINX_1 7bcf40a822c8 114_redis:v1 "docker-entrypoint.s…" About an hour ago Up 22 seconds 6379/tcp, 0.0.0.0:6380->6380/tcp, :::6380->6380/tcp docker_Redis_1 f8a58c3ba53e 114_uwsgi_django:v1 "uwsgi --ini ./_114d…" About an hour ago Up 22 seconds 0.0.0.0:5002->5002/tcp, :::5002->5002/tcp docker_uWSGI_Django_1