Docker

vim /etc/sysconfig/network-scripts/ifcfg-ens33 nginx

配置虛擬機Linux靜態IPdocker

TYPE="Ethernet"
BOOTPROTO=static
NAME="ens33"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="172.16.12.10"
NETMASK=255.255.255.0
GATEWAY="172.16.12.2"
DNS1="172.16.12.2"
DNS2="114.114.114.114"
DNS3="8.8.8.8"

重啓網絡
systemctl restart networkshell

下載 安裝
https://developer.aliyun.com/mirror/docker-ce?spm=a2c6h.13651102.0.0.2bbe1b11Ve34cgjson

自啓動
systemctl start docker 重啓docker systemctl restart docker
開機啓動
systemctl enable docker
查看docker狀態
systemctl status dockervim

vim /etc/docker/daemon.jsonbash

{
  "registry-mirrors": [
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn"
  ]
}

從新加載配置文件
systemctl daemon-reload
重啓docker
systemctl restart docker網絡

docker images 查看 安裝的dockerui

[root@localhost ~]# docker run --name nginx-coder -P  nginx 
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2021/07/17 09:16:21 [notice] 1#1: using the "epoll" event method
2021/07/17 09:16:21 [notice] 1#1: nginx/1.21.1
2021/07/17 09:16:21 [notice] 1#1: built by gcc 8.3.0 (Debian 8.3.0-6) 
2021/07/17 09:16:21 [notice] 1#1: OS: Linux 3.10.0-1160.el7.x86_64
2021/07/17 09:16:21 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2021/07/17 09:16:21 [notice] 1#1: start worker processes
2021/07/17 09:16:21 [notice] 1#1: start worker process 31
172.16.12.1 - - [17/Jul/2021:09:18:35 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36" "-"

[root@localhost ~]# docker run -di --name nginx -p 80:80 nginx
docker exec -it nginx /bin/bashrest

刪除容器
docker rm nginx-coder code

相關文章
相關標籤/搜索