Skip to content

Instantly share code, notes, and snippets.

@wcarhart
Created October 22, 2019 18:45
Show Gist options
  • Save wcarhart/df004401e561b012c793849f747d5f06 to your computer and use it in GitHub Desktop.
Save wcarhart/df004401e561b012c793849f747d5f06 to your computer and use it in GitHub Desktop.
Setup Docker for a Centos VM (on Hyper-V)
# THIS IS FOR AN OLDER VERSION OF DOCKER
# if you're using a custom docker space on a mounted drive, ensure the drive mounted correctly
# determine where the mount is
df -h
# then, format the disk as necessary (may have to remove partition and remount)
fdisk /dev/sda # or /dev/sdb, etc.
p # print partitions
d # delete partition
p # print partitions (to confirm deletion)
w # write (save) changes
# install docker if it isn't installed already: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-centos-7
# stop docker if it's running
service docker stop
# decide where you'll keep your custom docker space
mkdir -p /docker_space
# edit docker configurations
mkdir -p /etc/systemd/system/docker.service.d
cd /etc/systemd/system/docker.service.d
touch dcustom.conf
echo "[Service]" >> dcustom.conf
echo "EnvironmentFile=-/etc/sysconfig/docker" >> dcustom.conf
echo "EnvironmentFile=-/etc/sysconfig/docker-storage" >> dcustom.conf
echo "EnvironmentFile=-/etc/sysconfig/docker-network" >> dcustom.conf
echo "ExecStart=" >> dcustom.conf
echo 'ExecStart=/usr/bin/dockerd --graph="/docker_space" --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdrive=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --selinux-enabled --log-driver=journald --signature-verification=false' >> dcustom.conf
# reboot docker
rm -rf /var/lib/docker
systemctl daemon-reload
service docker start
# confirm changes
docker info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment