Docker is the most-loved programming tool according to Stack Overflow’s 2022 and 2023 developer survey.

It is widely used in IT and has revolutionized the way we deploy applications.

And of course, you could alsoinstall Docker on macOSandWindows.

ubuntu running as a docker container

Docker Hub is the recommended repository to get publicly verified and official Docker images.

you might also use Docker Hub to manage and create private Docker images.

A container is a running instance of a Docker image.

docker_images_on_a_pc

The/bin/bashargument is a way of telling the container to runthe Bash shell terminal.

Finally, the–rmflag instructs Docker to automatically remove the Ubuntu Docker container after we stop it.

By default, the container gets a random hostname.

docker running the ubuntu container

The Ubuntu Docker image is only about 78MB, which is super light.

Remember, Docker images only come with the core elements and nothing else.

Thanks to the power of Docker, we can run Ubuntu in Docker using very minimal system resources.

ubuntu os information on docker

Once installed, you could run thelsb_release -acommand and this time around you’ll get some output.

That is how Docker containers are designed; they’re easy to replace, stop, and manage.

The Ubuntu image in the output above has the ID524aa76baafb, yours will be a different one.

list docker containers on Ubuntu

Also, Docker image names can only be lowercase.

The preceding command will pause the container before saving it and will create a new Docker image namedmyubuntu.

The new Docker image will contain all changes that you’ve made to it.

And with that, you’ve just created a custom Ubuntu Docker image.

List your Docker images using thesudo docker imagescommand; your new custom image should be listed along.

There are two main options: using mounted volumes or Docker volumes.

Docker advocates for the latter because it is better in comparison to mounted volumes.

you’ve got the option to create a Docker volume anywhere on your PC.

Alternatively, you cancreate a docker-compose fileto easily fire up your Docker images.

The command will start the Ubuntu image and create the/datadirectory within the Docker container.

The/datadirectory is mapped to theDocker_Sharefolder you created earlier.

The reverse is also true; Docker will replicate any file modifications in theDocker_Sharedirectory in the/datadirectory of the container.