标签:页面 auto tag rom nta 替换 for start tcp
一、docker安装配置[root@docker ~]#vi /etc/hostname
[root@docker ~]# cat /etc/redhat-release #查看版本号
CentOS Linux release 7.7.1908 (Core)
[root@docker ~]# uname -r #查看linux内核
3.10.0-1062.el7.x86_64
[root@docker ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #替换为阿里云yum
[root@docker ~]# yum makecache #生成缓存仓库
[root@docker ~]# yum install docker -y
[root@docker ~]# systemctl start docker #启动docker
[root@docker ~]# systemctl enable docker #添加开机启动
[root@docker ~]# systemctl status docker #查看docker状态
[root@docker ~]# docker version
Client:
Version: 1.13.1
API version: 1.26
Package version: docker-1.13.1-161.git64e9980.el7_8.x86_64
Go version: go1.10.3
Git commit: 64e9980/1.13.1
Built: Tue Apr 28 14:43:01 2020
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Package version: docker-1.13.1-161.git64e9980.el7_8.x86_64
Go version: go1.10.3
Git commit: 64e9980/1.13.1
Built: Tue Apr 28 14:43:01 2020
OS/Arch: linux/amd64
Experimental: false
[root@docker ~]# docker search nginx
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/nginx Official build of Nginx. 13212 [OK]
[root@docker ~]# docker pull nginx
Using default tag: latest
Trying to pull repository docker.io/library/nginx ...
latest: Pulling from docker.io/library/nginx
afb6ec6fdc1c: Pull complete
b90c53a0b692: Pull complete
11fa52a0fdc0: Pull complete
Digest: sha256:30dfa439718a17baafefadf16c5e7c9d0a1cde97b4fd84f63b69e13513be7097
Status: Downloaded newer image for docker.io/nginx:latest
[root@docker ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/nginx latest 9beeba249f3e 6 days ago 127 MB
[root@docker ~]# docker run -p 8000:80 --name mynginx -d nginx ##-p指定服务器8000端口,映射容器80端口,容器名为mynginx,-d使用守护进程模式启动
886c281c102a68484f0788ad878b776cc609a8cd46af644d3e011859b48c2605
[root@docker ~]# docker ps #查看目前工作的容器
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
886c281c102a nginx "nginx -g ‘daemon ..." 33 seconds ago Up 33 seconds 0.0.0.0:8000->80/tcp mynginx
[root@docker ~]# docker ps -a #查看所有已运行的容器
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
886c281c102a nginx "nginx -g ‘daemon ..." 41 seconds ago Up 40 seconds 0.0.0.0:8000->80/tcp mynginx
[root@docker ~]# docker exec -it 886c281c102a /bin/bash
root@886c281c102a:/# #主机名已发生变化
[root@docker ~]# yum list installed | grep docker
docker.x86_64 2:1.13.1-161.git64e9980.el7_8 @extras
docker-client.x86_64 2:1.13.1-161.git64e9980.el7_8 @extras
docker-common.x86_64 2:1.13.1-161.git64e9980.el7_8 @extras
[root@docker ~]# yum remove docker.x86_64 docker-client.x86_64 docker-common.x86_64 -y
[root@docker ~]# rm -rf /var/lib/docker/
标签:页面 auto tag rom nta 替换 for start tcp
原文地址:https://blog.51cto.com/2755788/2498244