log-diginori / log-diginori.github.io

grep -E 'oepn|source|mind' log.diginori.log
https://log.diginori.com
1 stars 2 forks source link

[official document practice] getting started docker compose #43

Open becky2sawyer opened 1 year ago

becky2sawyer commented 1 year ago
becky2sawyer commented 1 year ago

compose ps VS container ps

$ docker compose ls
NAME                STATUS              CONFIG FILES
composetest         running(2)          /Users/m2/code/k9s/compose/gettingstarted/composetest/docker-compose.yml
$ docker compose ps
NAME                  IMAGE               COMMAND                  SERVICE             CREATED             STATUS              PORTS
composetest-redis-1   redis:alpine        "docker-entrypoint.s…"   redis               About an hour ago   Up 9 minutes        6379/tcp
composetest-web-1     composetest-web     "flask run"              web                 11 minutes ago      Up 9 minutes        0.0.0.0:8008->5000/tcp
$ docker container ps
CONTAINER ID   IMAGE             COMMAND                  CREATED             STATUS              PORTS                    NAMES
457d1860656b   composetest-web   "flask run"              3 minutes ago       Up About a minute   0.0.0.0:8008->5000/tcp   composetest-web-1
5e0ec8c553a7   redis:alpine      "docker-entrypoint.s…"   About an hour ago   Up About a minute   6379/tcp                 composetest-redis-1
$ docker ps          
CONTAINER ID   IMAGE             COMMAND                  CREATED             STATUS              PORTS                    NAMES
457d1860656b   composetest-web   "flask run"              3 minutes ago       Up About a minute   0.0.0.0:8008->5000/tcp   composetest-web-1
5e0ec8c553a7   redis:alpine      "docker-entrypoint.s…"   About an hour ago   Up About a minute   6379/tcp                 composetest-redis-1
becky2sawyer commented 1 year ago

compose run

compose --help

docker compose --help

Usage:  docker compose [OPTIONS] COMMAND

Docker Compose

Options:
      --ansi string                Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")
      --compatibility              Run compose in backward compatibility mode
      --env-file string            Specify an alternate environment file.
  -f, --file stringArray           Compose configuration files
      --parallel int               Control max parallelism, -1 for unlimited (default -1)
      --profile stringArray        Specify a profile to enable
      --project-directory string   Specify an alternate working directory
                                   (default: the path of the, first specified, Compose file)
  -p, --project-name string        Project name

Commands:
  build       Build or rebuild services
  convert     Converts the compose file to platform's canonical format
  cp          Copy files/folders between a service container and the local filesystem
  create      Creates containers for a service.
  down        Stop and remove containers, networks
  events      Receive real time events from containers.
  exec        Execute a command in a running container.
  images      List images used by the created containers
  kill        Force stop service containers.
  logs        View output from containers
  ls          List running compose projects
  pause       Pause services
  port        Print the public port for a port binding.
  ps          List containers
  pull        Pull service images
  push        Push service images
  restart     Restart service containers
  rm          Removes stopped service containers
  run         Run a one-off command on a service.
  start       Start services
  stop        Stop services
  top         Display the running processes
  unpause     Unpause services
  up          Create and start containers
  version     Show the Docker Compose version information

Run 'docker compose COMMAND --help' for more information on a command.
becky2sawyer commented 1 year ago

-d start stop donw