以下均为root用户操作,因此无需在命令前添加sudo命令
1、删除旧版本(之前未安装则无需操作)
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2、安装软件包并设置存储库
3 、安装最新版本的docker
4、启动docker并通过运行映像来验证 Docker 引擎是否已正确安装
# docker run hello-world
5、查看当前版本信息及版本详细信息
6、登录ubuntu(退出时先CTRL+p再CTRL+q)
报错(意思是不能上网)
编写文件vim
写入net.ipv4.ip_forward=1
重启网络并查看是否修改成功(=1即为成功)
成功登录ubuntu
7、调用nginx、alpine、httpd
docker pull : 从镜像仓库中拉取或者更新指定镜像
docker pull [OPTIONS] NAME[:TAG|@DIGEST]
tag 不写则为默认最新版
删除单个镜像 docker rmi -f <镜像id>
Using default tag: latest(不写版本,默认latest)
latest: Pulling from library/nginx
a2abf6c4d29d: Pull complete
a9edb18cadd1: Pull complete
589b7251471a: Pull complete
186b1aaa4aa6: Pull complete
b4df32aa5a72: Pull complete
a0bcbecc962e: Pull complete
Digest: sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31(签名防伪)
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest (真实地址)
查看是否已拉取
8、标记本地镜像,并将其归入仓库,使用
# docker tag httpd:latest test/httpd:v1