Update the /etc/docker/daemon.json as follow (will require root priveleges):

"live-restore": true,
"group": "dockerroot"

Add user (replace ) to "dockerroot" group using the below command and then restart the docker service.

$ sudo usermod -aG dockerroot <user name>
$ sudo restart docker service

See Comments in portion of the Vagrantfile below.

config.vm.provider "virtualbox" do |vb|
# Start the window that will allow GUI interaction with the VM
vb.gui = true
# Allocate memory to VM
vb.memory = "4092"
# Allocate 4 CPUs to VM
vb.cpus = 4
# Create a dvd drive to allow installation of virtualbox guest tools
vb.customize ["storageattach", :id,
"--storagectl", "IDE Controller",
"--port", "0", "--device", "1",
"--type", "dvddrive",
"--medium", "emptydrive"]
# Allocate video ram
vb.customize ["modifyvm", :id, "--vram", "48"]

First, click here to go to the steps to create the VM.

Then proceed

Install groups, set the run level and reboot

$ sudo yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
$ systemctl set-default graphical.target

In order to install VirtualBox Guest Additions, you will also need to install depedencies. Also note you will need the specific kernel headers for your version of the kernel so you may need to get a specific version of kernel-devel.

$ sudo yum install gcc make perl kernel-devel
$ sudo yum update

Restart the VM from outside of the VM using vagrant

> vagrant reload
Create Git and Docker Dev VM

Starting from no installation of software you can quickly get to a working git and docker environment by doing the following:

  • Download and install Oracle VirtualBox
  • Downlaod and install Hashicorp Vagrant
  • Create a directory to host your new Vagrantfile and add the bento box for the latest centos.
$ vagrant box add https://app.vagrantup.com/bento/boxes/centos-7.5
$ vagrant init bento/centos-7.5
  • Modify the Vagrantfile to meet your needs, additional instructions in Vagrantfile Modifications blog post.
  • Then bring the machine up.
$ vagrant up
  • Login to the new vm using
$ vagrant ssh
  • Install applications
$ sudo yum install docker vim git
$ sudo systemctl enable docker.service
$ sudo systemctl start docker

* * Setup git configuration including email and name

$ git config --global user.name "Your Name"
$ git config --global user.email "your@email.address"
  • Add your github SSH key to ~/.ssh and remember to change the mode to 600
$ chmod 600 ~/.ssh/<key file name>
  • Add your SSH key to SSH agent. If your SSH agent isn’t started then go here for walkthrough on adding code to start SSH agent on login.

Next Steps

From Zero to Octopress in Docker

First, click here to go to the steps to create the VM.

Then proceed

  • Clone your Octopress repo
  • Create the following Dockerfile in the root of your repo:
FROM ubuntu:16.04
RUN apt-get update -y && apt-get -y install \
sudo \
gcc make \
git \
vim less \
curl \
ruby ruby-dev \
python2.7 python-pip python-dev \
# Install program to configure locales
RUN apt-get install -y locales
# Install needed default locale for Makefly
RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && \
# Set default locale for the environment
# Add blogger user
RUN adduser --disabled-password --gecos "" blogger && \
echo "blogger ALL=(root) NOPASSWD:ALL" > /etc/sudoers
USER blogger
# Directory for the blog files
RUN sudo mkdir /octopress
WORKDIR /octopress
# Set permissions so blogger can install gems
RUN sudo chown -Rv blogger:blogger /octopress
RUN sudo chown -Rv blogger:blogger /var/lib/gems
RUN sudo chown -Rv blogger:blogger /usr/local/bin
# Expose port 4000 so we can preview the blog
# Add the Gemfile and install the gems
ADD Gemfile /octopress/Gemfile
RUN gem install bundler
RUN bundle install
RUN echo 'SSH_ENV="$HOME/.ssh/environment"\n\
function start_agent {\n\
echo "Initialising new SSH agent..."\n\
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"\n\
echo succeeded\n\
chmod 600 "${SSH_ENV}"\n\
. "${SSH_ENV}" > /dev/null\n\
echo "Manage keys as follows..."\n\
echo "ssh-add <identity file> Add identity file."\n\
echo "ssh-add -L List the keys currently." \n\
echo "ssh-add -D Delete the keys."\n\
# Source SSH settings, if applicable\n\
if [ -f "${SSH_ENV}" ]; then\n\
. "${SSH_ENV}" > /dev/null\n\
#ps ${SSH_AGENT_PID} doesn't work under cywgin\n\
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {\n\
>> ~/.profile
  • Build the docker container
$ docker build . -t blog/octopress
  • Run the docker container
$ docker run -p 4000:4000 --rm --volume ${PWD}:/octopress \
--volume /home/vagrant/.ssh:/home/blogger/.ssh -ti blog/octopress /bin/bash
  • Now you are in the docker container, I had to run bundle install and then the octopress commands were available to me as long as I prefixed them with bundle exec
$ bundle install
  • Source the profile file so that you have SSH agent.
$ . ~/.profile
$ ssh-add ~/.ssh/<key file name>
  • You’ll need to setup git config again like in the Dev VM post here.
  • Modfiy posts and deploy.