Centos7 Docker安装及常用参数解释

472 阅读1分钟

Docker分社区版与企业版
社区版安装步骤
1.卸载旧版本(Uninstall old versions)
sudo yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-engine

2.运行
sudo yum install -y yum-utils
device-mapper-persistent-data
lvm2

3.使用下面命令,创建稳定的仓库
sudo yum-config-manager
--add-repo
download.docker.com/linux/cento…

  1. 安装最新版的社区版docker
    sudo yum install docker-ce docker-ce-cli containerd.io

5.systemctl start docker
启动docker

docker 参数解释

1) -it -i则让容器的标准输入保持打开,-t让docker分配一个伪终端并绑定到容器的标准输入上 可交互性。
The -it flag makes the container interactive, meaning it attaches the terminal’s standard input and output to the container so that you can see what is going on in the container

2)--rm --rm选项不能与-d同时使用,即只能自动清理foreground容器,不能自动清理detached容器
--rm flag instructs Docker to remove the container when it is stopped

3) docker ps -a 查询所有docker镜像信息

4) docker stop "name" 或者 docker stop “containerId” 来关闭docker 镜像。