Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To switch the Docker storage engine from devicemapper to overlay2, follow these steps:

  1. Stop the Docker daemon:
sudo systemctl stop docker
  1. Check the current storage driver by running the following command:
docker info | grep "Storage Driver"
  1. If the output shows "devicemapper," backup any existing Docker data by moving it to a new directory:
sudo mv /var/lib/docker /var/lib/docker.bak
  1. Install the packages required for overlay2:
sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get install docker-ce
  1. Edit the Docker daemon configuration file:
sudo vim /etc/docker/daemon.json
  1. Add the following lines to the file:
{
  "storage-driver": "overlay2"
}
  1. Save and close the file.

  2. Start the Docker daemon:

sudo systemctl start docker
  1. Verify that the storage driver has been changed to overlay2:
docker info | grep "Storage Driver"

The output should show "overlay2."