擔(dān)路網(wǎng)絡(luò)科技有限公司的證書(shū)靠譜seo整站優(yōu)化外包
文章目錄
- 1.安裝docker服務(wù),配置鏡像加速器
- 2.下載系統(tǒng)鏡像(Ubuntu、 centos)
- 3.基于下載的鏡像創(chuàng)建兩個(gè)容器 (容器名一個(gè)為自己名字全拼,一個(gè)為首名字字母)
- 4.容器的啟動(dòng)、 停止及重啟操作
- 5.怎么查看正在運(yùn)行的容器和所有容器?
- 6.怎么退出容器: 兩種方法分別實(shí)現(xiàn)?
- 7.怎么連接到運(yùn)行的容器?
- 8.查看容器或鏡像的內(nèi)部信息?
- 9.如何查看所有鏡像
1.安裝docker服務(wù),配置鏡像加速器
安裝軟件包
[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
設(shè)置yum源
[root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安裝
[root@localhost ~]# yum list docker-ce --showduplicates | sort -r
[root@localhost ~]# yum -y install docker-ce-18.03.1.ce
啟動(dòng)docker設(shè)置開(kāi)機(jī)自啟
[root@sql2 ~]# systemctl start docker
[root@sql2 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
配置鏡像加速器
2.下載系統(tǒng)鏡像(Ubuntu、 centos)
[root@sql2 ~]# docker pull ubuntu
3.基于下載的鏡像創(chuàng)建兩個(gè)容器 (容器名一個(gè)為自己名字全拼,一個(gè)為首名字字母)
[root@sql2 ~]# docker run --name yuanting -it ubuntu /bin/bash
root@3ee108fd6ce8:/# exit
[root@sql2 ~]# docker run --name yt -it centos /bin/bash
[root@315cf79e1717 /]# exit
4.容器的啟動(dòng)、 停止及重啟操作
啟動(dòng)
[root@sql2 ~]# docker start yuanting
yuanting
停止
[root@sql2 ~]# docker stop yuanting
yuanting
重啟
[root@sql2 ~]# docker restart yuanting
yuanting
5.怎么查看正在運(yùn)行的容器和所有容器?
查看正在運(yùn)行的容器
查看所有容器
[root@sql2 ~]# docker ps -a
6.怎么退出容器: 兩種方法分別實(shí)現(xiàn)?
① [root@sql2 ~]# docker run --name yuanting -it ubuntu /bin/bash
root@3ee108fd6ce8:/# exit
②crtl+q
7.怎么連接到運(yùn)行的容器?
[root@sql2 ~]# docker exec -it yuanting /bin/bash
root@3ee108fd6ce8:/#