Isolated Dockers - Setting up

How to tune your Docker containers for those off-line trips. Here is how to 'superfy' them!

Isolated Dockers - Setting up
Credit Benjamin Voros

So you are going camping and work out of docker. You get out there to only realize that most of your containers did not have the stuff you needed to actually do stuff. Cell phone service is just not there. You are stuck.

  • Typically one would first try to 'superfy' your Dockerfile adding in everything and the sink,
RUN DEBIAN_FRONTEND=noninteractive dpkg -i /files/jdk.deb
RUN DEBIAN_FRONTEND=noninteractive add-apt-repository "deb focal u>
RUN DEBIAN_FRONTEND=noninteractive apt update
RUN DEBIAN_FRONTEND=noninteractive dpkg -i /files/apache.deb
etc.. etc.. etc..

However some things cannot be done from the command line.

Here is how to solve that.

  • Get your Dockerfile to a good position.
  • Build and run your image into a container (typically in internet accessing) mode
  • Activate each application and add what it needs while you have internet:
In this case we are adding all the nice extras to the powerful Lazarus-ide
  • Netbeans - if you are running netbeans inside your docker it can take quite a while for it to unpack it's central repository.  Until that is done many of the plugins will not work. Also test and run some packages as they may require to download stuff.
  • In this instance it has been working and unpacking things now for about 15 minutes. It is just slow.

Netbeans with a pile of good juicy plug-ins activated:

Once you have your docker container all tweaked up - leave it running but close it's applications.  Make a snapshot of it.

docker commit <docker container> <docker image name>

voila you have created a custom image that can now be pushed up and around.

To login to your docker account:

docker login -u <username> -p <password>

You need to tag your docker image to your repository.  If your image is named 'bob' then it needs to have the tag '<your_repository>/bob'  

docker tag <image> <repository>/<image>

Once you have done that you can now push it upstream:

docker push <repository>/image:latest

If you were to simply try to push your image without specifying the account you will get a push denied.

Linux Rocks Every Day