Docker Compose Up, Docker Compose Down, Docker Compose Start und Docker Compose Stop

In diesem Docker verfassen wir einen Tutorial-Beitrag, über den wir diskutieren Docker Compose-up-Befehl, Docker Compose Down-Befehl, Docker Compose-Startbefehl Und Docker Compose-Stoppbefehl.

Docker Compose Up, Docker Compose Down, Docker Compose Start und Docker Compose Stop

1. Was ist der Docker Compose Stop-Befehl?

Wie der Name schon sagt, stoppt der Docker Compose Stop-Befehl alle Dienste. Der Stoppbefehl von Docker Compose entfernt KEINE Container, stoppt jedoch die mit einer Docker Compose-Konfiguration verbundenen Dienste.

2. Was ist der Docker Compose Up-Befehl?

Der Befehl „Docker Compose up“ erstellt, (neu) erstellt, startet und hängt an Container für einen Dienst an.

3. Was ist der Docker Compose-Startbefehl?

Der Docker Compose-Startbefehl startet alle gestoppten Dienste. Wenn Sie Dienste mit dem Befehl „docker-compose stop“ gestoppt haben, können Sie diesen Startbefehl verwenden, um diese Dienste zu starten.

4. Was ist der Docker Compose Down-Befehl?

Der Befehl „Docker-Compose Down“ entfernt alle Container und internen Netzwerke, die mit den Diensten verknüpft sind, und stoppt alle Dienste, die mit einer Docker Compose-Konfiguration verknüpft sind.

Docker-Komposition mit Beispiel

Verwendung:

 docker-compose up (options) (--scale SERVICE=NUM...) (SERVICE...) 

Befehlsoptionen für Docker-compose up:

-d, --detach                  Detached mode: Run containers in the background,
                               print new container names. Incompatible with
                               --abort-on-container-exit.
    --no-color                 Produce monochrome output.
    --quiet-pull               Pull without printing progress information
    --no-deps                  Don't start linked services.
    --force-recreate           Recreate containers even if their configuration
                               and image haven't changed.
    --always-recreate-deps     Recreate dependent containers.
                               Incompatible with --no-recreate.
    --no-recreate              If containers already exist, don't recreate
                               them. Incompatible with --force-recreate and 
                               --renew-anon-volumes.
    --no-build                 Don't build an image, even if it's missing.
    --no-start                 Don't start the services after creating them.
    --build                    Build images before starting containers.
    --abort-on-container-exit  Stops all containers if any container was
                               stopped. Incompatible with --detach.
    --attach-dependencies      Attach to dependent containers.
    -t, --timeout TIMEOUT      Use this timeout in seconds for container
                               shutdown when attached or when containers are
                               already running. (default: 10)
    -V, --renew-anon-volumes   Recreate anonymous volumes instead of retrieving
                               data from the previous containers.
    --remove-orphans           Remove containers for services not defined
                               in the Compose file.
    --exit-code-from SERVICE   Return the exit code of the selected service
                               container. Implies --abort-on-container-exit.
    --scale SERVICE=NUM        Scale SERVICE to NUM instances. Overrides the
                               `scale` setting in the Compose file if present.

Docker-Komposition mit Beispiel

Der Docker-Compose-Down-Befehl stoppt Container und entfernt Container, Netzwerke, Volumes und Images, die mit dem Docker-Compose-Up-Befehl erstellt wurden.

Verwendung:

docker-compose down (options)

Docker-Compose-Down-Befehlsoptionen:

--rmi type              Remove images. Type must be one of:
                              'all': Remove all images used by any service.
                              'local': Remove only images that don't have a
                              custom tag set by the `image` field.
    -v, --volumes           Remove named volumes declared in the `volumes`
                            section of the Compose file and anonymous volumes
                            attached to containers.
    --remove-orphans        Remove containers for services not defined in the
                            Compose file
    -t, --timeout TIMEOUT   Specify a shutdown timeout in seconds.
                            (default: 10)

Docker Compose beginnt mit einem Beispiel

Es startet vorhandene Container für einen Dienst.

Verwendung:

docker-compose start (SERVICE...)

Docker Compose Stop mit Beispiel

Verwendung:

docker-compose stop (options) (SERVICE...)

Docker-Compose-Stop-Befehlsoption:

-t, --timeout TIMEOUT      Specify a shutdown timeout in seconds.
                             (default: 10)

Docker Stop Container-Befehle (Beispiele)

Beitragsnavigation

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert