What is the difference between docker and docker-compose

后端 未结 2 1223
清歌不尽
清歌不尽 2020-12-07 07:30

docker and docker-compose seem to be interacting with the same dockerFile, what is the difference between the two tools?

2条回答
  •  时光说笑
    2020-12-07 08:08

    docker manages single containers

    docker-compose manages multiple container applications

    Usage of docker-compose requires 3 steps:

    1. Define the app environment with a Dockerfile
    2. Define the app services in docker-compose.yml
    3. Run docker-compose up to start and run app

    Below is a docker-compose.yml example taken from the docker docs:

    services:
      web:
        build: .
        ports:
        - "5000:5000"
        volumes:
        - .:/code
        - logvolume01:/var/log
        links:
        - redis
      redis:
        image: redis
    volumes:
      logvolume01: {}
    

提交回复
热议问题