【任务1】Docker CE及私有仓库安装任务
【适用平台】私有云
【题目】安装Docker CE和Docker Compose
在master、node各节点中分别安装DockerCE和docker-compose。完成后提交master节点的用户名、密码和IP到答题框。
关闭SELinux和防火墙
yum install -y yum-utils device-mapper-persistent-data lvm2
# yum install -y docker-ce
# systemctl start docker
# systemctl enable docker
cp -rfv /opt/docker-compose/v1.25.5-docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
# docker-compose version
docker-compose version 1.25.5, build 8a1c60f6
docker-py version: 4.1.0
CPython version: 3.7.5
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
【题目】安装私有仓库
在master节点安装私有仓库,导入/opt/images目录下所有镜像,并推送到私有仓库。完成后提交master节点的用户名、密码和IP到答题框。
docker load -i /opt/images/*.tar
解压安装包:
# cd harbor/
# tar -zxvf harbor-offline-installer-v2.1.0.tgz
# cd harbor
修改Harbor配置信息:
# cp harbor.yml.tmpl harbor.yml
# vi harbor.yml
hostname: 10.18.4.10 # 将域名修改为本机IP
harbor_admin_password: Harbor12345
#https: # 禁用https
# https port for harbor, default is 443
# port: 443
# The path of cert and key files for nginx
# certificate: /your/certificate/path
# private_key: /your/private/key/path
【题目】容器编排
在master节点上编写/root/owncloud/docker-compose.yaml文件,具体要求如下:
(1)容器1名称:owncloud;镜像:owncloud:latest;
(2)挂载路径:/data/db/owncloud:/var/www/html/data;
(3)owncloud端口映射:5679:80;
(4)容器2名称owncloud-db;镜像:mysql:5.6;
(5)数据库密码:123456。
完成后编排部署ownCloud,并提交master节点的用户名、密码和IP到答题框。
version: '3'
services:
owncloud:
image: owncloud:latest
container_name: owncloud
volumes:
- "/data/db/owncloud:/var/www/html/data"
links:
- mysql:mysql
ports:
- "5679:80"
mysql:
image: mysql:5.6
container_name: owncloud-db
volumes:
- "/data/db/mysql:/var/lib/mysql"
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: "123456"
MYSQL_DATABASE: owncloud