1

I'm feeling really terrible atm so any help would be really appreciated. I kept running out of space when downloading docker images on /var, so I decided I needed to change the location for where docker was installing images. I tried several methods but had no success. First, I tried creating daemon.json in etc/docker and mapping data-root to a place with more storage (data2/docker). I stopped docker, moved everything over, made the file, but no dice. The docker daemon wouldn't start. Then, I saw this method https://stackoverflow.com/a/49743270/13034460 which involves creating a symbolic link between /var/lib/docker and the new directory (data2/docker). I followed his instructions:

Much easier way to do so:

Stop docker service: sudo systemctl stop docker

Move existing docker directory to new location sudo mv /var/lib/docker/ /path/to/new/docker/

Create symbolic link sudo ln -s /path/to/new/docker/ /var/lib/docker

Start docker service sudo systemctl start docker

Well, this didn't work for me. I can't find the error message b/c it's too far up in my terminal, but it was along the lines of "you don't have enough storage/we don't know where to store this image". /data2/docker should have tons of storage so that can't be the issue.

But the big problem now is that this symbolic link exists and I can't figure out how to get rid of it. I tried removing everything related to docker on the computer, uninstalling, then reinstalling docker (which always used to work for me if there were any issues). But when I reinstall, it won't even run docker hello-world b/c of the link (I think). I get a message:

docker: open /data2/docker/tmp/GetImageBlob289478576: no such file or directory

So...it's looking in data2/docker because of the symbolic link (I assume), but that directory doesn't exist anymore. But neither does /var/lib/docker! All I want is to delete this link and get everything back to fresh defaults. I can worry about the storage issue another time. If I can't use docker at all, I'm so screwed. I've tried looking in every directory to find the link using -ls -l, but I can't find it. I used the exact code that the above references when I created the link (just my paths instead).

I would be so grateful to anyone who could help--I'm so lost on this. Thank you!

Brian Winston
  • 51
  • 1
  • 4
  • 1
    Did you check `/data2/docker/tmp/GetImageBlob289478576` really exists there? COuld you check your `/data2/docker/tmp/` folder has any files? – F.Igor Jul 10 '20 at 20:14
  • data2/docker is completely empty – Brian Winston Jul 10 '20 at 20:15
  • 1
    You should be able to just `sudo rm /var/lib/docker`, if it's a symlink. But if you're seeing messages that explicitly reference a `/data2` path, it's more likely you've modified the Docker daemon configuration; try looking for changes in `/etc/docker/daemon.json` or try running `sudo systemctl edit docker.service`. (Looking at [Post-installation steps for Linux](https://docs.docker.com/engine/install/linux-postinstall/) in the Docker docs.) – David Maze Jul 10 '20 at 20:15
  • strangely /var/lib/docker is gone, and so is /etc/docker. a bit confused what editing docker.service would do even after reading the docs – Brian Winston Jul 10 '20 at 20:17
  • 1
    After doing the symbolic link, no modification to `daemon.json` should be needed. So you need to reset or remove the daemon.json file (its original state), and run docker again, or re-install it if nothing works. – F.Igor Jul 10 '20 at 20:24
  • `daemon.json` is gone. maybe I need to make a new empty one? as I mentioned, `etc/docker` is gone. Edit: creating a docker directory and empty daemon.json worked to at least get /var/lib/docker back. Thanks!! – Brian Winston Jul 10 '20 at 20:27

0 Answers0