When we use our knowledge on how to host Docker image sources on GitHub and how to publish images on the Docker Registry Hub, it'll be no problem creating our data volume image.
Let's create a branch and a Dockerfile and add the content for our data volume image:
git checkout -b data vi Dockerfile git add Dockerfile
On line number 2 in the preceding code, you can use the text editor of your choice. I just happen to find vi
suits my needs. The content you should add to the Dockerfile is this:
FROM busybox:latest MAINTAINER Oskar Hane <[email protected]> RUN mkdir /var/lib/mysql && mkdir /var/www/html VOLUME ["/var/lib/mysql", "/var/www/html"]
Replace the maintainer information with your name and e-mail.
You can—and should—always ensure that it works before committing and pushing to GitHub. To do so, you need to build a Docker image from your Dockerfile:
docker build –t data-test .
Make sure you notice the dot at the end of the line, which means that Docker should...