What is the difference between docker-compose up and docker-compose start?

前端 未结 2 708
庸人自扰
庸人自扰 2020-12-12 13:05

Whenever I execute

docker-compose start 
docker-compose ps

I see my containers with the state \"UP\". If I do

docker-compos         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-12 14:00

    docker-compose start
    (https://docs.docker.com/compose/reference/start/)

    Starts existing containers for a service.

    docker-compose up
    (https://docs.docker.com/compose/reference/up/)

    Builds, (re)creates, starts, and attaches to containers for a service.

    Unless they are already running, this command also starts any linked services.

    The docker-compose up command aggregates the output of each container (essentially running docker-compose logs -f). When the command exits, all containers are stopped. Running docker-compose up -d starts the containers in the background and leaves them running.

    If there are existing containers for a service, and the service’s configuration or image was changed after the container’s creation, docker-compose up picks up the changes by stopping and recreating the containers (preserving mounted volumes). To prevent Compose from picking up changes, use the --no-recreate flag.

    For the complete CLI reference:
    https://docs.docker.com/compose/reference/

提交回复
热议问题