目录
一、说明
二、离线安装Docker
1)将下载的包上传到服务器上去
2)安装docker
3) 启动docker
4)配置加速器
三、安装云桌面镜像
四、启动云桌面
方式一:docker命令直接运行
方式二:docker-compose方式
五、登录云桌面
一、说明
docker官网下载地址:Index of linux/static/stable/x86_64/ (docker.com)
本文章使用的下载地址:https://download.docker.com/linux/static/stable/x86_64/docker-19.03.9.tgz
环境:Centos7.6_x86 3.10.0-957.el7.x86_64
二、离线安装Docker
1)将下载的包上传到服务器上去
2)安装docker
[root@web02 ~]# tar -xzvf docker-19.03.9.tgz
[root@web02 ~]# cp docker/* /usr/bin/
[root@web02 ~]# cat >/usr/lib/systemd/system/docker.service <<EOF
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target docker.socket
[Service]
Type=notify
EnvironmentFile=-/run/flannel/docker
WorkingDirectory=/usr/local/bin
ExecStart=/usr/bin/dockerd \
-H unix:///var/run/docker.sock \
--selinux-enabled=false \
--log-opt max-size=1g \
--default-ulimit nofile=65535:65535
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
3) 启动docker
[root@web02 ~]# systemctl start docker
[root@web02 ~]# systemctl enable docker
4)配置加速器
[root@web02 ~]# cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": [
"https://2a6bf1988cb6428c877f723ec7530dbc.mirror.swr.myhuaweicloud.com",
"https://docker.m.daocloud.io",
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"https://your_preferred_mirror",
"https://dockerhub.icu",
"https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc"
]
}
EOF
[root@web02 ~]# systemctl daemon-reload
[root@web02 ~]# systemctl restart docker
三、安装云桌面镜像
#如果pull不下来,本文章提供百度网盘下载链接: 百度网盘 请输入提取码 提取码: 1sd3
[root@web02 ~]# docker pull swr.cn-north-1.myhuaweicloud.com/iivey/linux-desk:v1.0
四、启动云桌面
方式一:docker命令直接运行
[root@web02 ~]# docker run -itd --shm-size 4G -p 6080:6080 -e VNC_PASSWD=admin123456 -e GEOMETRY='1366x768' -e DEPTH=32 -v /data/Downloads:/root/Downloads/ -v /data/Documents:/root/Documents -v /data/Pictures:/root/Pictures -v /data/Videos:/root/Videos -v /data/Desktop:/root/Desktop --restart unless-stopped --name linuxdesk swr.cn-north-1.myhuaweicloud.com/iivey/linux-desk:v1.0
方式二:docker-compose方式
如果用docker-compose方式启动,docker-compose的官网:Releases · docker/compose
本文章使用的是版本为1.16.1,百度网盘下载链接:百度网盘 请输入提取码 提取码: sdc5
docker-compose.yml文件内容如下:
version: '2.3'
services:
ubuntu-xfce-vnc:
container_name: linux-desk
image: swr.cn-north-1.myhuaweicloud.com/iivey/linux-desk:v1.0
shm_size: "2gb"
ports:
- 5900:5900
- 6080:6080
environment:
- VNC_PASSWD=admin123456
- GEOMETRY=1280x720
- DEPTH=24
volumes:
- /data/Downloads:/root/Downloads
- /data/Documents:/root/Documents
- /data/Pictures:/root/Pictures
- /data/Videos:/root/Videos
- /data/Music:/root/Music
- /data/Desktop:/root/Desktop
restart: "always"
五、登录云桌面
浏览器访问:http://IP:6080