We’ve been moving a bunch of servers into magic cloudy land. A move which comes with a whole lot of additional security restrictions (and accompanying marketing that the cloud is so much more secure … uhh, no … any host to which you used a keylogged jump server to access & it had absolutely no access to the internal or external network without a specific request and firewall rule would be equally secure. You just haven’t bothered with all of those controls before!). As such, we cannot just pull an image from Docker Hub. We also cannot just use apt-get to install/update packages.
So … how can you build a Docker image with updated software for use on these locked down boxes? Bit of a trick question — you cannot. You can, however, build such an image elsewhere and then export/import the image.
Build the image using your Dockerfile
docker build -t my_app_base .
Then export the image you created
docker save my_api_base | gzip > myapp_image.tar.gz
Download the TGZ file and transfer it to your restricted-access host. Then import the image
docker load < myapp_image.tar.gz
Verify the image loaded successfully
[user@server ~]$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/my_app_base latest 5z8e35z99d5z 19 minutes ago 995 MB <none> <none> 5zdbcfz6393z About an hour ago 1.01 GB
Now use docker run with your my_app_base:latest image to create a running container based on the image.