Hướng dẫn aws docker cheat sheet - bảng gian lận aws docker

Hoàn thành Docker Cli

Hướng dẫn aws docker cheat sheet - bảng gian lận aws docker

Show

CLIS quản lý container

Hướng dẫn aws docker cheat sheet - bảng gian lận aws docker

Kiểm tra container

Hướng dẫn aws docker cheat sheet - bảng gian lận aws docker

Tương tác với container

Hướng dẫn aws docker cheat sheet - bảng gian lận aws docker

Lệnh quản lý hình ảnh

Hướng dẫn aws docker cheat sheet - bảng gian lận aws docker

Lệnh chuyển hình ảnh

Hướng dẫn aws docker cheat sheet - bảng gian lận aws docker

Trình tạo các lệnh chính

Hướng dẫn aws docker cheat sheet - bảng gian lận aws docker

Docker cli

Quản lý hình ảnh

docker exec [options] CONTAINER COMMAND -d, --detach # run in background -i, --interactive # stdin -t, --tty # interactive 5

docker build [options] .
  -t "app/container_name"    # name

Tạo một

docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive
6 từ Dockerfile.

docker exec [options] CONTAINER COMMAND -d, --detach # run in background -i, --interactive # stdin -t, --tty # interactive 7

docker run [options] IMAGE
  # see `docker create` for options

Chạy một lệnh trong một

docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive
6.

Quản lý container

docker exec [options] CONTAINER COMMAND -d, --detach # run in background -i, --interactive # stdin -t, --tty # interactive 9

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars

Thí dụ

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2

Tạo

$ docker exec app_web_1 tail logs/development.log
$ docker exec -t -i app_web_1 rails c
0 từ
docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive
6.

$ docker exec app_web_1 tail logs/development.log $ docker exec -t -i app_web_1 rails c 2

docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive

Thí dụ

$ docker exec app_web_1 tail logs/development.log
$ docker exec -t -i app_web_1 rails c

Tạo

$ docker exec app_web_1 tail logs/development.log
$ docker exec -t -i app_web_1 rails c
0 từ
docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive
6.

$ docker exec app_web_1 tail logs/development.log $ docker exec -t -i app_web_1 rails c 4

docker start [options] CONTAINER
  -a, --attach        # attach stdout/err
  -i, --interactive   # attach stdin

docker stop [options] CONTAINER

Chạy các lệnh trong

$ docker exec app_web_1 tail logs/development.log
$ docker exec -t -i app_web_1 rails c
0.

$ docker exec app_web_1 tail logs/development.log $ docker exec -t -i app_web_1 rails c 6

$ docker ps
$ docker ps -a
$ docker kill $ID

Bắt đầu/dừng một

$ docker exec app_web_1 tail logs/development.log
$ docker exec -t -i app_web_1 rails c
0.

Quản lý $ docker exec app_web_1 tail logs/development.log $ docker exec -t -i app_web_1 rails c 0s bằng PS/KILL.

$ docker exec app_web_1 tail logs/development.log $ docker exec -t -i app_web_1 rails c 8

$ docker images
  REPOSITORY   TAG        ID
  ubuntu       12.10      b750fe78269d
  me/myapp     latest     7b2431a8d968

$ docker images -a   # also show intermediate

Hình ảnh

docker start [options] CONTAINER -a, --attach # attach stdout/err -i, --interactive # attach stdin docker stop [options] CONTAINER 0

Quản lý

docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive
6s.

Xóa docker exec [options] CONTAINER COMMAND -d, --detach # run in background -i, --interactive # stdin -t, --tty # interactive 6s.

  • Cũng thấy

Bắt đầu (Docker.io)

Dockerfile

Di sản

docker run [options] IMAGE
  # see `docker create` for options
0

Biến

docker run [options] IMAGE
  # see `docker create` for options
1

docker run [options] IMAGE
  # see `docker create` for options
2

Khởi tạo

docker run [options] IMAGE
  # see `docker create` for options
3

Onbuild

docker run [options] IMAGE
  # see `docker create` for options
4

Lệnh

docker run [options] IMAGE
  # see `docker create` for options
5

Nhập cảnh

Định cấu hình một container sẽ chạy như một thực thi.

Điều này sẽ sử dụng xử lý vỏ để thay thế các biến shell và sẽ bỏ qua bất kỳ đối số dòng lệnh docker start [options] CONTAINER -a, --attach # attach stdout/err -i, --interactive # attach stdin docker stop [options] CONTAINER 2 hoặc docker exec [options] CONTAINER COMMAND -d, --detach # run in background -i, --interactive # stdin -t, --tty # interactive 7 nào.

docker run [options] IMAGE
  # see `docker create` for options
6

docker run [options] IMAGE
  # see `docker create` for options
7

metadata

  • Xem thêm

docker-compose

https://docs.docker.com/engine/reference/Builder/

docker run [options] IMAGE
  # see `docker create` for options
8

Onbuild

docker run [options] IMAGE
  # see `docker create` for options
9

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars
0

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars
1

Lệnh

Nhập cảnh

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars
2

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars
3

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars
4

Định cấu hình một container sẽ chạy như một thực thi.

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars
5

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars
6

Onbuild

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars
7

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars
8

Lệnh

docker create [options] IMAGE
  -a, --attach               # attach stdout/err
  -i, --interactive          # attach stdin (interactive)
  -t, --tty                  # pseudo-tty
      --name NAME            # name your image
  -p, --publish 5000:5000    # port map
      --expose 5432          # expose a port to linked containers
  -P, --publish-all          # publish all ports
      --link container:alias # linking
  -v, --volume `pwd`:/app    # mount (absolute paths needed)
  -e, --env NAME=hello       # env vars
9

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2
0

Nhập cảnh

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2
1

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2
2

Định cấu hình một container sẽ chạy như một thực thi.

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2
3

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2
4

Điều này sẽ sử dụng xử lý vỏ để thay thế các biến shell và sẽ bỏ qua bất kỳ đối số dòng lệnh docker start [options] CONTAINER -a, --attach # attach stdout/err -i, --interactive # attach stdin docker stop [options] CONTAINER 2 hoặc docker exec [options] CONTAINER COMMAND -d, --detach # run in background -i, --interactive # stdin -t, --tty # interactive 7 nào.

metadata

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2
5

Xem thêm

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2
6

https://docs.docker.com/engine/reference/Builder/

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2
7

Ví dụ cơ bản

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2
8

Tài liệu tham khảo

$ docker create --name app_redis_1 \
  --expose 6379 \
  redis:3.0.2
9

Tòa nhà

Cổng

Biến môi trường

docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive
0

Phụ thuộc

docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive
1

Sự lựa chọn khác

docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive
2

Các tính năng tiên tiến

Nhãn

Máy chủ DNS

Thiết bị

liện kết ngoại

Chủ nhà

docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive
3

Sevices

docker exec [options] CONTAINER COMMAND
  -d, --detach        # run in background
  -i, --interactive   # stdin
  -t, --tty           # interactive
4

Để xem danh sách tất cả các dịch vụ chạy trong Swarm

Để xem tất cả các dịch vụ đang chạy