docker仓库
文章目录
概述
仓库(Repository)是集中存放镜像的地方
docker仓库常用命令
登录
shell
docker login
登出
shell
docker logout
拉取镜像
shell
docker pull ubuntu
推送镜像
用户登录后,可以通过 docker push 命令将自己的镜像推送到 Docker Hub。 以下命令中的 szitcast请替换为你的 Docker 账号用户名。
shell
docker login
# 将本地镜像重命名成规范名称
deng@itcast:~$ docker tag hello-world:latest szitcast/hello:v1.0
deng@itcast:~$ docker images
#推送自己的镜像
deng@itcast:~$ docker push szitcast/hello:v1.0
#查询自己账户的镜像
deng@itcast:~$ docker search szitcast/hello
运行日志
查看日志
shell
docker logs clever_johnson
容器详细信息
shell
docker inspect [容器id|镜像id]
#示例一:
docker inspect c9d12ce939a0
查看容器端口信息
shell
docker port <container_id>
# 示例:
docker port c9d12ce939a0
映射
随机映射
shell
docker run -d -P nginx
#随机启动多个个,端口都不会重复 docker run -d -P nginx docker run -d -P nginx
指定端口映射
shell
docker run -d -p 10086:80 nginx
查看映射端口信息
shell
docker port sad_gates
host模式
shell
docker run -d --network host nginx
docker ps