Docker Community Forums

Share and learn in the Docker community.

Newbie admin questions

(Marcchamberlin) #1

Please forgive me if these questions are really basic and answered somewhere but I am not finding them…

As an admin for some physically remote systems I need to understand a couple things before I can recommend using Docker containers and images.

  1. How are image updates handled and distributed to users? If I create a container with one or more images in it, (acquired from the docker store) deploy it on a remote system, by what mechanism do I acquire updates from the developers of those images, and incorporate those updates into my images/containers on my remote system? Is there some kind of auto update process that I subscribe to? Is version differences somehow automatically detected and is the administrator notified of the availability of newer versions? Where is this documented? I am not finding the answers so maybe I am missing something fundamental and my model/understanding of software development cycles does not apply in the Docker context? Again please forgive me if I am asking a really dumb bunch of questions…

  2. On a Linux system (openSuSE in particular) what is the best approach to automatically starting up containers and images after a system reboot? I am familiar with using services and daemons, (YaST, systemctl) and while I see the docker service itself, I don’t see the mechanism by which I would automatically start up a container containing images for say Apache Tomcat or James servers, (or other servers for that matter) Do I need to write my own startup scripts? Or is there some built-in persistent mechanism by which the docker server “knows” what containers and images should be automatically started?

  3. If my understanding of Docker is correct, if I want to start up different servers, am I facing the possibility of having to manage different containers with different OS images being used to support each server I want to run? For example, if I install a container to run the Apache Tomcat server, and an Apache HTTP server, an Apache James server, an VSFTPD server etc, will each of these be working in the same OS environment inside their containers, or am I facing having to learn the subtleties of running each server in a different OS environment if/when I connect in to a shell running in the container supporting each server?

I will stop now, am sure I will have many more questions as I learn the ropes… Please be tolerant of my asking basic questions…

Thanks in advance,   Marc...

(David Maze) #2

A container is based on exactly one image.

(Docker Hub)

docker pull a new image

If you’ve built your own image based on a public image, docker build it again. Then docker stop, docker rm, docker run a new container based on the updated image.

Plan for your containers to be regularly destroyed and recreated from scratch.

There are many events that can cause you to need to docker rm your container. Updating to a newer version of the underlying image is one; there are some options like port mappings that can only be specified when you initially docker run the container, and if you ever need to change those, you need to restart it. Your container may need to know to fetch or create some data on its initial startup; if your container has persistent filesystem state, you probably need to use named volumes or host filesystem bind mounts to store it.

I’m not aware of either of these, though it wouldn’t surprise me if someone has built them.

docker run --restart always will restart a container at boot time. Or you can write an init script if that works better for you.

Most containers ignore the really strange differences in different distributions (systemd) and just directly run a daemon. The majority of containers have a {{/bin/bash}} that you can run from outside, and a daemon in {{/usr/bin}} or {{/usr/sbin}}, and you don’t really notice it being Debian or CentOS or Alpine based.