Docker实战
作者:hackett
微信公众号:加班猿
一、准备工具
云服务器
我用的是腾讯云的Centos7.5 64位不到一百块一年的云服务器,你也可以用虚拟机
![d7fbaea844cd2ab6e939294c0e35c489.png](https://i-blog.csdnimg.cn/blog_migrate/fcf660047f4082667489812d9d8963cb.png)
二、登录服务器工具
MobaXterm
1、之所以用这个作为ssh客户端,主要原因就是基于MobaXterm强大且丰富的功能,并且还都是免费的
MobaXterm主要功能:
- 支持各种连接 SSH,X11,RDP,VNC,FTP,MOSH
- 支持 Unix 命令(bash,ls,cat,sed,grep,awk,rsync,…)
- 连接 SSH 终端后支持 SFTP 传输文件
- 各种丰富的插件(git/dig/aria2…)
- 可运行 Windows 或软件
下载地址:https://mobaxterm.mobatek.net/download-home-edition.html
![50af1ae753b5338c95c95c9b50927e1c.png](https://i-blog.csdnimg.cn/blog_migrate/e3d1f41928db079269980c138a6913b4.png)
2、登录服务器
![7c475002d0af1d0b264d1a63e97dd395.png](https://i-blog.csdnimg.cn/blog_migrate/56fb6e4e31e34f6ce9f3cc6e9a1f04ca.png)
三、Centos Docker安装
1、使用官方安装脚本安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
2、使用国内 daocloud 一键安装命令
curl -sSL https://get.daocloud.io/docker | sh
3、检查是否安装成功(docker -v)
[root@VM-0-11-centos ~]# docker -v
Docker version 20.10.0, build 7287ab3
[root@VM-0-11-centos ~]#
4、启动docker
sudo systemctl start docker
5、通过hello world映像验证是否正确安装Docker
[root@VM-0-11-centos ~]# sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
Status: Downloaded newer image for hello-world:latest
Hello from Docker! //可以看到这里成功运行了
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable tha