基本概念:

  • dockerfile, 相当于makefile这种构建文件
  • image
  • container

拉取image

  • docker pull

从远端拉取别人build好的image文件

image file location

On Windows, Open the Docker Desktop application on your computer and go to the “Settings” menu. Click on the “Resources” tab and then click on the “Advanced” button to see the configuration settings for Docker.

查看当前正在运行的container

  • docker ps
  • docker container ls

When you use the “docker container ls” command with the “—all” or “-a” option, like this: “docker container ls —all” or “docker container ls -a”, it shows all containers, including those that are not currently running.

这两个命令起一样的作用, 在最新版本的docker中, 后者完全可以替代前者的作用

对container的操作

  • start
  • stop
  • restart

How can I access Docker container?

Just use docker exec -it my-container bash

The -it option specifies that the command should be run interactively in a terminal session, and bash is the command that will be executed.

docker compose

通过docker compose可以依托docker-compose.yml文件更容易的控制一个容器的生命周期

关于docker