I was hoping someone could help me to retrace my steps in moving the named volumes to a different location.
I’m running Docker 1.12.6 and Docker Compose 1.12.0 on RHEL 7. The only
sudo accesses I was granted are
By the way, the created name volumes resides under Docker root dir… in my case,
/var/lib/docker/volumes/.... However, I quickly ran out of space after migrating data from other server into the named volume.
The good news is I was provided a different mount
/apps with bigger disk space. Here’s my
Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_apps-lv_apps 197G 10G 177G 6% /apps /dev/mapper/vg_system-lv_var 9.8G 2.4G 6.9G 26% /var
The Good News
So, yesterday, for some reason, after reading https://github.com/moby/moby/issues/30441 and spending hours tinkering around, I was able to migrate the named volume from its default location to
/apps/docker-volumes/. Here, I have 2 named volumes residing under
xxx@yyy:/apps/docker-volumes $ ls -la /apps/docker-volumes/ drwxrwxr-x+ 5 xxx xxx 4096 Jun 2 14:15 . drwxrwxr-x+ 7 root root 4096 Jun 2 09:35 .. drwxr-xr-x+ 25 1000 1000 4096 Jun 2 14:03 jenkins drwx------+ 17 200 200 4096 Jun 2 13:53 nexus
To test my sanity, I decided to perform some commands that would add/remove files in these named volumes… and it worked as intended.
The Bad News
Today, I spent the whole day trying to reproduce the steps I did yesterday… but I was unable to get a new named volume created under
So, I created a simplified
docker-compose.yml that looks like this:-
version: '2' services: jenkins: image: "jenkinsci/jenkins" ports: - "8080:8080" volumes: - test:/var/jenkins_home volumes: test: driver_opts: type: none device: /apps/docker-volumes/test o: bind
xxx@yyy:/apps/docker-volumes $ ls -la /apps/docker-volumes/ drwxrwxr-x+ 5 xxx xxx 4096 Jun 2 14:15 . drwxrwxr-x+ 7 root root 4096 Jun 2 09:35 .. drwxr-xr-x+ 25 1000 1000 4096 Jun 2 14:03 jenkins drwx------+ 17 200 200 4096 Jun 2 13:53 nexus drwxrwxr-x+ 2 xxx xxx 4096 Jun 2 14:15 test
Before I run the container, I ensured there are no running containers (
sudo docker ps -a ) and there are not same volume names (
sudo docker volume ls ).
Then I tried to run the container, but it failed with this error:-
xxx@yyy:/apps/docker-test $ sudo docker-compose up Creating volume "dockertest_test" with default driver Creating dockertest_jenkins_1 ERROR: for jenkins Cannot create container for service jenkins: no such file or directory ERROR: Encountered errors while bringing up the project.
I know I missed a few crucial steps in between, but granted I was dead tired yesterday, I just couldn’t recall what else I did different than today.
I truly appreciate it if someone could throw me a pointer or two on how I can fix this problem. It has been very frustrating thus far knowing that I unconsciously solved it yesterday.
Thank you very much for your help in advance.