Introduction

I am using a fake init for debuging and to make sure the container will always be able to start without issue. You can change the CMD statement once you are done with debugging.

Preparing the custom image

Fetch/Update the official Ubuntu docker image,

docker pull ubuntu

Prepare your Dockerfile and install scripts,

mkdir -p ~/images/ubuntu/upload/
cd ~/images/ubuntu/
wget https://raw.githubusercontent.com/pbraun9/doc/master/docker/ubuntu/Dockerfile
cd upload/
wget https://raw.githubusercontent.com/pbraun9/doc/master/docker/ubuntu/upload/fakeinit.bash
wget https://raw.githubusercontent.com/pbraun9/doc/master/docker/ubuntu/upload/install.bash
chmod +x *

cd /home/elge/images/ubuntu
diff -bu ~/doc/docker/ubuntu/Dockerfile Dockerfile
cd /home/elge/images/ubuntu/upload
diff -bu ~/doc/docker/ubuntu/upload/fakeinit.bash fakeinit.bash
diff -bu ~/doc/docker/ubuntu/upload/install.bash install.bash
cp -pf ~/doc/docker/ubuntu/upload/fakeinit.bash .
cp -pf ~/doc/docker/ubuntu/upload/install.bash .
chmod +x *.bash
cd ..
cp -pf ~/doc/docker/ubuntu/Dockerfile .

Build the custom image,

cd ~/images/ubuntu
docker build -t custom-ubuntu .

note. -t to tag/name the docker image

References

References about volumes