Nethence NEWDOC OLDDOC Lab Webmail Your IP BBDock  

Setting up a custom Ubuntu Docker image

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 http://doc.nethence.com/input/docker/ubuntu/Dockerfile
cd upload
wget http://doc.nethence.com/input/docker/ubuntu/upload/fakeinit.sh
wget http://doc.nethence.com/input/docker/ubuntu/upload/install.bash
chmod +x *
cd ..

Build the custom image,

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

note. -t for tagging the docker image name

Launch the custom Ubuntu container

Make sure /data/$app doesn’t exist yet and proceed,

app=<app name>
docker ps -a | grep $app
docker run -d --name $app -h $app \
    -p 8080:80 -p 8443:443 \
    -v /data/$app:/$app \
    custom/ubuntu
docker ps -a | grep $app
docker logs $app
docker exec -ti $app bash

References