Ubuntu Bionic Docker Image

  1. Ubuntu Bionic Beaver Docker Image
  2. Ubuntu Bionic Docker Image File
  3. Ubuntu Bionic Docker Image
  4. Ubuntu Bionic Docker Image Download
  • #docker , #linux , #ubuntu
  • 5 minutes read
Ubuntu Bionic Docker Image

Say, you will build the image 'my/ubuntu-bionic-jdk-mvn-py3-x11'. Docker build -t my/ubuntu-bionic-jdk-mvn-py3-x11. To run your own image, say, with some-ubuntu. LTS Docker Images Ubuntu › Best Images the day at www.ubuntu.com. Posted: (5 days ago) The LTS Docker Image Portfolio provides ready-to-use application base images, free of high and critical CVEs. Images are built on the same secure infrastructure that builds Ubuntu, and updated automatically when apps or dependencies are fixed.

Steps to create Ubuntu docker base image. We are using our Ubuntu 16.04 LTS Desktop for creating base image.Hence,all commands are for debian/ubuntu system. Login as root or superuser. Either login as root or become superuser by using command sudo su. Create directory for docker image workshop.

Have you ever noticed that some days your Ubuntu server updates take a really long time to download? Or maybe you run a small datacenter’s worth of Ubuntu servers and want to update them regularly but not use 30x more of your bandwidth to download packages. Either way, a local Ubuntu repository is a good solution to both of these problems.

We’ll set up our mirror to run in a Docker stack using Docker Compose. This is a nice way of encapsulating all of the configuration that goes into a setup like this in an easily commitable package.

Start by setting up a directory for the project:

Ubuntu Bionic Beaver Docker Image

We’re going to use a tool called apt-mirror to do the heavy lifting of cloning the official repos for us, so we need to make a container for it to run in. We’ll use Alpine Linux as a base image to reduce image size. This means we won’t be able to use apt-get to install apt-mirror, but we can just clone the Github repo instead.

Here’s what my Dockerfile looks like:

We’re using a common technique to reduce image size here by consolidating everything into one RUN command. This creates less layers in the Docker container, but comes with the cost of reduced readability.

You’ll need an entrypoint.sh script to start apt-mirror and run it again every 6 hours.

Now let’s build the image and see what happens.

Well, there is no /etc/apt directory and there certainly isn’t a mirror.list. The repo contains a sample mirror.list so we can start from there.

Make your own copy of mirror.list in the project directory and edit it to suit your preferences. The syntax for specifying repos is the same as what you’d find in sources.list on an Ubuntu system, which is nice.

Here’s what mine looks like:

If you support more than one release of Ubuntu feel free to add more deb lines but be aware that the more repositories you add to your mirror the more disk space it’s going to take up. At the time of this writing, the mirror that I set up using this procedure takes up about 280GB.

You can point these deb lines at an Ubuntu mirror of your choosing should you prefer to use a mirror closer to you for speed. Just know that some mirrors are more up to date than others. You can find a list of official Ubuntu mirrors here along with information about how up to date they are.

Even though my system is amd64 I found I had to pull the i386 arch repos using deb-i386. YMMV.

Now that we have our config file the way we want it, we can revise our run command to look like this:

You should now see aptmirror happily begin constructing your mirror for you. Let this command run over night (add a -d in the command above to run it in the background) and when you get up you should see a brand new mirror in the volume or directory.

While you can serve Ubuntu repositories over FTP, I’ve always found HTTP-based mirrors to be faster and the configuration is easier too. We’ll use nginx for this but you can just as easily use Apache2 if it suits your fancy.

Here’s my nginx.conf file:

And finally the docker-compose.yml file to tie everything together:

We can see our new aptmirror service, along with a build: directive so Compose knows build this image instead of fetch it. There’s a shared volume so nginx can see our mirror files to serve them and a volume to get mirror.list where we need it to be.

For the web service, I’ve added the same volume as above but made it read-only. Also note that you need to specify shared volumes at the bottom of the file so Compose knows about them.

Let’s fire this up!

Ubuntu Bionic Docker Image

If all goes well, you should see a directory index with a single folder in it like this:

Congratulations! You’re now the proud owner of an Ubuntu repository mirror.

Our mirror isn’t much use to us unless we configure apt on our Ubuntu machines to point to it. To do this, we need to edit /etc/apt/sources.list to include our mirror and comment out the official lines. You’ll probably need to update this if you ever do a dist-upgrade since sources.list will likely be overwritten during that process.

I added the following two lines to my sources.list:

I also went through and commented out all of the official deb lines except the security ones. Make sure the release (bionic in this case) matches what you see in your sources.list!

Ubuntu Bionic Docker Image File

Now we can run an index update and see if it worked:

You should see successful updates from your new mirror. If you don’t, make sure you’ve got the correct IP address. Also make sure there isn’t a firewall running on your Docker host.

I would definitely test this out with a VM before you mess with any production servers, but this is working pretty okay for me and I enjoyed building it.

You can find the code and configuration for this setup here.

Ubuntu Bionic Docker Image

Docker is a container platform that streamlines software delivery and provides isolation, scalability, and efficiency with less overhead than OS level virtualization.

These instructions are taken directly from the official Docker for Ubuntu page, but I wanted to reiterate those tasks essential for installing the Docker Community Edition on Ubuntu bionic 18.04.

Uninstall older versions

Setup Docker Repository

Install Docker Community Edition

This should have installed docker which is running under systemd. The docker engine logs should report “Started Docker Application Container Engine”.

systemd will already have the service configured to start on boot, but if you want to check:

Validate Install

The docker run command from above should return a message like:

Docker without sudo

You have have noticed that you had to run docker with sudo in the hello-world test above. That is because the Docker daemon binds to a unix socket which is owned by root. If you don’t want to force sudo access, then you can create a ‘docker’ group and add your user to it.

Logout, then log back in to make sure the membership is reevaluated (su – $USER). Then test by running hello-world again without sudo.

Ubuntu Bionic Docker Image

Ubuntu Bionic Docker Image Download

Docker via TCP

By default, the docker daemon listens on a local unix port owned by root (/run/docker.sock) which means your docker client will only work from the installed server and as sudo.

If you want to use a remote docker CLI to connect to this server, you need to consider the security implications and then you can create the x509 certs to secure the communication as described in the official docs.

Docker Compose

If you want to install docker-compose, you can do so with Python’s pip “sudo pip install docker-compose”, but you are going to get an older version. It is better to install the latest release (check for the latest version here).



Ubuntu bionic docker image file

backing storage for docker

Most Viewed Posts