Docker Compose Commands

      1. docker-compose build → When need new images. ALL IMAGES NEW
      2. docker-compose build mongo → just build one service. In this case, mongo
      3. docker-compose up -d → create & start containers as running services

(“up” does NOT rebuild images. Use “build”)

      1. docker-compose up --no-deps node → can add additional command lines
      2. docker-compose down → stops AND REMOVES all containers/services
      3. docker-compose down -rmi all --volumes → also removes all images & volumes
      4. docker-compose stop → stop services/containers. Does NOT remove
      5. docker-compose start → start the services/containers back up
      6. docker-compose logs -f → view the logs. -f = follow (outputs new logs)
      7. docker-compose cont-name -f → views logs of just that container
      8. docker-compose ps → all containers managed by docker compose
      9. docker-compose rm → remove ALL containers managed by docker-compose
      10. Differences between start & up
        1. $ docker-compose start
          1. simply starts existing containers for a service.
        2. $ docker-compose up
          1. Builds, (re)creates, starts, and attaches to containers for a service. (NOT images)
          2. Linked services will be started, unless they are already running.
          3. By default, docker-compose up will aggregate the output of each container and, when it exits, all containers will be stopped. Running docker-compose up -d, will start the containers in the background and leave them running.
          4. By default, if there are existing containers for a service, docker-compose up will stop and recreate them (preserving mounted volumes with volumes-from), so that changes in docker-compose.yml are picked up. If you do not want containers stopped and recreated, use docker-compose up --no-recreate. This will still start any stopped containers, if needed.
          5. Source: https://docs.docker.com/v1.5/compose/cli/

results matching ""

    No results matching ""