Alpine Docker: The secret to creating ultralight containers

Alpine is a Linux distribution. Docker gives you a small (only 5 MB) Alpine Linux image. Alpine Linux Docker images have an advantage over Ubuntu images because of their relatively small size and offer almost all the features that an Ubuntu image can provide. In this article, we’ll take a look at how to build an Alpine Linux image. We will also try to install the MySQL client in the Alpine Linux Docker Container, Python 3 and Firefox.

To create an Alpine Docker Container, follow these steps:

Step 1: Pull out and run the Alpine image

To run the Alpine Image Docker container, you can use the Docker run command.

sudo docker run -it alpine:3

Run the Alpine container

Once the image is loaded, it will automatically open the shell for you.

Step 2: Install Python 3

To install python 3 in an Alpine container, you can use the apk to add commands inside the shell.

apk add python3

Install Python 3

Step 3: Install MySQL in the container

You can install the My-SQL client using the following command:

apk add mysql-client

My-SQL client

Step 4: Install Firefox

To install Firefox in a Container, you can use the following command.

apk add firefox

Install Firefox

Step 5: Commit the changes in the image

You’ll need the container number to commit the changes in the image.

To find the container ID, use this command.

sudo docker ps -a

Copy the container ID and paste it into this command.

sudo docker commit eacdf78d1bde my-alpine

“my-alpine” is the new image name.

You can verify this by listing the images.

sudo docker images

Docker commit