赞
踩
操作系统 | 配置 | 主机名 | IP | 所需软件 |
---|---|---|---|---|
CentOS 7.9 | 2C4G | cook | 192.168.93.101 | Docker最新版 |
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
hostnamectl set-hostname cook
# 安装依赖环境
yum install -y yum-utils device-mapper-persistent-data lvm2
# 添加CentOS官方镜像站
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum clean all && yum makecache
# 安装Docker
yum -y install docker-ce docker-ce-cli containerd.io
# 启动Docker
systemctl start docker
systemctl enable docker
cd /etc/docker/
cat >> daemon.json << EOF
{
"registry-mirrors": ["https://8xpk5wnt.mirror.aliyuncs.com"]
}
EOF
systemctl restart docker
[root@localhost ~]# docker version Client: Docker Engine - Community Version: 26.1.4 API version: 1.45 Go version: go1.21.11 Git commit: 5650f9b Built: Wed Jun 5 11:32:04 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 26.1.4 API version: 1.45 (minimum version 1.24) Go version: go1.21.11 Git commit: de5c9cf Built: Wed Jun 5 11:31:02 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.33 GitCommit: d2d58213f83a351ca8f528a95fbd145f5654e957 runc: Version: 1.1.12 GitCommit: v1.1.12-0-g51d5e94 docker-init: Version: 0.19.0 GitCommit: de40ad0
[root@cook ~]# docker pull yunyoujun/cook:latest
latest: Pulling from yunyoujun/cook
9398808236ff: Pull complete
a4896b78e8db: Pull complete
a352ab202530: Pull complete
b9258afd0639: Pull complete
8799ab366479: Pull complete
07bc104f8702: Pull complete
8afc9a751a90: Pull complete
00bc879157ea: Pull complete
Digest: sha256:da4cf3c9ff86d980475182353f699261931d479ffeda5b84fecd0a109745a98c
Status: Downloaded newer image for yunyoujun/cook:latest
docker.io/yunyoujun/cook:latest
[root@cook ~]# docker run -d --name cook --restart always -p 80:80 yunyoujun/cook
7c02ec1a6985b84e0c51ddbfde9c26f6d90517caf5924761457f0daf12e59fac
[root@cook ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7c02ec1a6985 yunyoujun/cook "/docker-entrypoint.…" 24 seconds ago Up 24 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp cook
# 如果查看到的日志内容跟如下差不多没有明显错误,说明容器正常 [root@cook ~]# docker logs cook /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 2024/06/11 23:52:44 [notice] 1#1: using the "epoll" event method 2024/06/11 23:52:44 [notice] 1#1: nginx/1.24.0 2024/06/11 23:52:44 [notice] 1#1: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4) 2024/06/11 23:52:44 [notice] 1#1: OS: Linux 3.10.0-1160.71.1.el7.x86_64 2024/06/11 23:52:44 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 2024/06/11 23:52:44 [notice] 1#1: start worker processes 2024/06/11 23:52:44 [notice] 1#1: start worker process 30 2024/06/11 23:52:44 [notice] 1#1: start worker process 31
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。