Recently wanted to build a CI / CD environment to try, because the hands of cloud services is too small (1C1G), do not hold up gitlab and jenkins. It happened years ago with the Taiwan high version of windows machines, and wanted to install gitlab jenkins by docker on the home machine.
But after trying to find docker use in windows10 we have a lot of pit below, from postings on the Internet, as if the problem can not be short term fix (related to the file system), it is summed up, and stepped pit experience to share to you
Environment: win10 Professional Edition, using hyper V support docker, docker desktop community 2.2.0.4 (43472)
docker windows directory to mount the volume in question:
If it is read-only, then it can, docker can read files
If you need to write, such as the new files, the application does not match the permissions burst message, in short, is not written
Solution:
Creating a volume using the command docker volume create VOLUME-NAME, and direct use of this volume, we can achieve the purpose of persistent data
Example:
Then they brought a new problem:
If you need to access a file folder mount, how to access? How to back up these files?
Direct methods are given:
# Just pull a mirror, I prefer centos, ubuntu, etc. can also
docker pull centos
# Create a root image, in communication with the host
# Docker close this, the container without leaving any information
docker run --net = host --ipc = host --uts = host --pid = host -it --security- opt = seccomp = unconfined --privileged --rm -v /: / host centos / bin / bash
# Switch host environment
chroot / host
# Packaged image files to a backup folder
# before I docker desktop sharing the E disk folder to be mounted to the host_mnt directory, so you can directly tar package to the backup directory, of course, do not use Chinese directory recommendation
# / host_mnt / e / dockerdata / backup / are windows e previously created a disk for backup folder
# / var / lib / Docker / Volumes are created out of the use of docker volume create directory location, where you can see all of Volume
# gitlab -data is the volume name created
tar -zcvf /host_mnt/e/dockerdata/backup/gitlabdata.tar.gz /var/lib/docker/volumes/gitlab-data
After executing this command, you'll be in your windows directory E: found gitlabdata.tar.gz this backup file \ dockerdata under \ backup
If the data is reset, this can be considered the inverse operation instruction tar
reference:
https://blog.csdn.net/weixin_30677475/article/details/99035126