How/where are programs installed in Docker containers?
They are stored inside an image.
In a nutshell, what Docker does for you is this:
- It takes a prepared "image" (which you name on the command line
docker run ...).
- For all intents and purposes, you can consider this image as simply a volume stored somewhere in
/var/lib/docker, temporarily mounted somewhere on the host temporarily for you.
- Docker then executes an executable within that image as usual, but fakes its environment such that the new process thinks that the volume mounted in the previous step is its
/ directory. Also, the new process is pretty much encapsulated from the host, i.e., it shares nothing (other processes, files, networking etc.) unless specifically opened up by Docker for you.
Apart from that, everything is as usual. There is a lot of fakery going on, but technically, at the end of the day, it's just a normal Linux process. The magic happens due to namespacing, but it is mostly Linux magic, which is simply used by the Docker demon for you. Docker is like
chroot on steroids.
What Docker does is manage all the tiny bits and pieces for you - i.e., the image management (creating, deleting, listing etc.), the container management (running, stopping, inspecting etc.), virtual networking, the "onion" filesystems which you probably heard about and all such.
If I'm using a Docker container for my project and install anaconda and the other packages I use, is there a folder within the container containing the bash scripts
Yes, exactly. You acquire an image with anaconda, prepared by someone or yourself. The image is like a
.tar archive (in a different format), and mounted during runtime. Everything lives in there. (Nomenclature: the folder is within the image, which is mounted. The "container" is just the ephemeral runtime - the process, networking etc.).