【自学Docker】Docker HelloWorld
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
Docker HelloWorld
Docker服务
查看Docker服务状态
使用 systemctl status docker 命令查看 Docker 服务的状态。
haicoder(www.haicoder.net)# systemctl status docker
我们使用 systemctl status docker 命令查看 Docker 服务的状态显示结果如下图所示
其中 Active: active (running) 即表示 Docker 服务为正在运行状态。
停止Docker服务
使用 systemctl stop docker 命令停止 Docker 服务。
haicoder(www.haicoder.net)# systemctl stop docker
此时再次使用 systemctl status docker 命令查看 Docker 服务的状态显示结果如下图所示
此时 Docker 服务的状态为 Active: inactive (dead) 即停止状态。
启动Docker服务
使用 systemctl start docker 命令启动 Docker 服务。
haicoder(www.haicoder.net)# systemctl start docker
此时再次使用 systemctl status docker 命令查看 Docker 服务的状态显示结果如下图所示
此时 Docker 服务的状态为 Active: active (running) 即运行状态。
重启Docker服务
使用 systemctl restart docker 命令重启 Docker 服务。
haicoder(www.haicoder.net)# systemctl restart docker
下载Docker镜像(Images)
搜索Docker镜像(Images)
使用 docker search 命令从 Docker Repo 搜索 Dokcer 可用的镜像。
haicoder(www.haicoder.net)# docker search hello-world
我们使用 docker search 命令搜索名为 hello-world 的镜像搜索结果如下图所示
拉取Docker镜像(Images)
使用 docker image pull 命令从 Docker Repo 获取指定的 Dokcer镜像(Images)。
haicoder(www.haicoder.net)# docker image pull docker.io/hello-world
我们使用 docker image pull 命令拉取名为 docker.io/hello-world 的镜像拉取结果如下图所示
运行Docker镜像(Images)
查看Docker镜像(Images)
使用 docker image ls 命令查看本地的 Dokcer 镜像(Images)。
haicoder(www.haicoder.net)# docker image ls
我们使用 docker image ls 命令查看本地的 Dokcer 镜像(Images)本地镜像列表如下图所示
启动Docker镜像(Images)
使用 docker run 命令运行 Dokcer 镜像(Images)。
haicoder(www.haicoder.net)# docker run hello-world
我们使用 docker run 命令运行 Dokcer 镜像(Images)运行成功显示界面如下图所示