这是docker入门
查看
- docker images
- docker container ls
配置私服镜像
配置成功后查询不到
- 安装docker
brew install docker
- 配置镜像加速
vi /etc/docker/daemon.json
输入:
{ "registry-mirrors": ["https://registry.docker-cn.com"]}
- 启动docker
- 下载、运行私服
docker run -d -p 5000:5000 --restart=always --name registry registry:2
- 查看容器列表
docker container ls或者docker ps
- 拉ubuntu:16.04镜像
docker pull ubuntu:16.04
- 创建新的镜像,镜像命名前缀指定了推送的私服地址
docker image tag ubuntu:16.04 localhost:5000/myfirstimage
- 将镜像推送到运行于的本地注册表localhost:5000:
docker push localhost:5000/myfirstimage
- 删除本地镜像
docker image remove ubuntu:16.04
- 再从本地私服拉下来
dockder imagesdocker pull localhost:5000/myfirstimage
docker常有命令行
- 查看镜像
docker images
- 查看容器
docker ps
- 运行镜像容器,开启交互模式
docker run -it 77
- 退出交互模式
ctrl+p ctrl+q
- 安装软件
apt update
apt install vim
exit
6.打开镜像
//查询所有镜像
docker ps
//打开名为nostalgic_gagarin的镜像
docker attach nostalgic_gagarin