docker-compose.yml 如果定义镜像的名字和标签
PHPz
PHPz 2017-04-27 09:03:25
0
2
1158

例:docker-compose.yml的内容如下:

redis:
    build: .
    ports:
      - "6379:6379"

docker-compose up 执行完之后镜像的名字为redis_redis tag为latest 请问如何配置这个镜像的名字和标签呢?

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
redis_redis         latest
PHPz
PHPz

学习是最好的投资!

reply all(2)
Peter_Zhu

docker-compose generates a container based on your original image. What is defined in your yml file is redis. After generation, redis is the alias of this container. You can just use the name redis directly. docker-compose exec redis bash into your redis container.

黄舟
version: '2'
services:
    nginx:
        image: "${DOCKER_USER}/nginx:1.11"
        build:
            context: .
            dockerfile: Dockerfile-nginx
        volumes:

In the above example, you don’t need to write ${DOCKER_USER}, just write nginx:2.11 at the end. The “:” is preceded by the name and followed by Tag.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template