Personal computing discussed

Moderators: renee, SecretSquirrel, notfred

Doctor Venture
Gerbil First Class
Topic Author
Posts: 120
Joined: Thu Feb 19, 2015 2:23 am

Creating a new Docker container, based on another one

Tue Jun 20, 2017 10:08 pm

I'm not sure if this should go in Apps, or Linux, so I apologize in advance if this is in the wrong section!

Long story short, I'm pretty new to Docker. One of the simulators I use (GNS3) has an Ubuntu Docker container. It's missing a good amount of tools/software, in order to keep the size down.

What I'm curious about, is if there's any way to use that container as a "base", so that I can install other software on top of it (like Ansible, Chef, Saltstack, Ganglia/Nagios, etc....), and then split that out as a new container? Someone more knowledgeable about this than me posted some instructions, but there were some errors in it, so he pulled the guide down.

I was able to install Ansible and a bunch of roles into the Ubuntu container, and used gnome-term to supposedly make the Ansible container as a new device. As long as I kept it in the same topology (I removed and re-added it a bunch, and the changes were persistent.). However, once I created a new topology, and added the Ansible node, everything was gone. When I did the split (I think it was "docker commit --change 'ENTRYPOINT []' --change VOLUME '/root /etc/anisble /usr/lib/python2.7' [name] [string]"), it's still there in /var/lib/docker. It just doesn't work.

Is there any way to do what I accomplish, or would I be better off just starting from scratch? I've got several books on Docker, but they're just soooo boring. Even my ADHD medicine (Adderall) doesn't help me not get super-bored within a page or two. Any advice, or links that are at least semi-interesting? It's not a huge rush, I just want to make these because: A) I want to prove I can, and B) I've seen a LOT of requests asking for things like this. I've made Qemu server images of Ansible, Puppet, Chef, Saltstack, etc... in the past, but nobody wants to download a 1-2GB .qcow2 file. After getting Ansible set up in that Ubuntu docker container, it was only +500MB.

Thanks in advance, if anyone can help point me in the right direction.
Minister of Gerbil Affairs
Posts: 2756
Joined: Sun Jan 25, 2004 7:52 am
Location: That London (or so I'm told)

Re: Creating a new Docker container, based on another one

Tue Dec 10, 2019 12:35 pm

I'm new to docker too but isn't the idea to put additional tools in a separate container then connect the two so they can interact?
Your mother ate my dog!
Minister of Gerbil Affairs
Posts: 2495
Joined: Sat Mar 15, 2014 11:44 am

Re: Creating a new Docker container, based on another one

Tue Dec 10, 2019 1:59 pm

If it works without changing topology, then I'm not sure that's a packaging problem. "docker commit" is the command you use to generate a new image after making changes, and I'm assuming there's a good reason for changing the entry point.

Docker does have some odd rules about DNS resolution, but usually you don't have to worry about that when working with only a single container. Have you tried connecting to the container when it's running to rule out any connectivity issues? docker exec -it <container name> /bin/bash (or whatever shell you've got) should let you poke around in there and check things out.
Do not meddle in the affairs of archers, for they are subtle and you won't hear them coming.

Who is online

Users browsing this forum: No registered users and 1 guest