Creating a final image

Greetings.

I manage the Kubernetes environments at work and am studying Docker in order to provide better help for the developers.

Right now I’m trying to set up a simple static website in a docker container, then save it to a local registry, and finally deploy it to a Kubernetes cluster.

I’m following a tutorial in creating a docker container which is working fine. I’m able to use a docker-compose.yml file and a Dockerfile to pull the php:7-apache image and copy my small website into /var/www/html and docker run it. I get the website on localhost:8080 without a problem so that works fine.

Tagging the container also works fine but docker push to the registry fails to copy the contents of /var/www/html.

It seems like I’m missing a command or process to make the contents ov /var/www/html a part of that final tagged image.

All the tutorials I’ve been following are all assuming I’m working on a stand alone docker server and not pushing a built image with a separate website to an orchestration environment like Kubernetes or Swarm. They are all pushing nginx (for example) and showing the results as, “see, I got the nginx default webpage” which doesn’t help with a personal website. :slight_smile:

I did check the docs and see docker commit but it appears to be a quick-and-dirty tool as it says that work should be done in a dockerfile. Checking the reference for dockerfile doesn’t show a command for merging the website into a fresh image.

A pointer to a better developer type tutorial would be great or just confirming that ‘docker commit’ is actually the right command for adding my website to an image.

Thanks in advance.

Carl

Just wanted to note that it’s solved. Turns out the tutorial I was using was a Laravel one and put the files into a different directory and the followup docker-compose.yml file was using a bind storage and not adding it to the image. I corrected the first dockerfile copying the files into /var/www/html and it works, the website is showing up on my Kubernetes cluster.

Carl