Skip to content

Instantly share code, notes, and snippets.

@rcapile
Last active October 30, 2019 20:27
Show Gist options
  • Save rcapile/c7298bb5e732accc7fafdb501fe3508d to your computer and use it in GitHub Desktop.
Save rcapile/c7298bb5e732accc7fafdb501fe3508d to your computer and use it in GitHub Desktop.
Change docker default folder in Ubuntu

In file /lib/systemd/system/docker.service

change the line

ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

to

ExecStart=/usr/bin/dockerd --data-root /new/docker/path -H fd:// --containerd=/run/containerd/containerd.sock

then run

sudo systemctl daemon-reload
sudo service docker restart

To access it via bash

docker exec -it <container name> /bin/bash 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment