Docker Ubuntu Desktop Image
2/12/2022by admin
Estimated reading time: 3 minutes
Most Dockerfiles start from a parent image. If you need to completely controlthe contents of your image, you might need to create a base image instead.Here’s the difference:
A parent image is the image that yourimage is based on. It refers to the contents of the
FROM
directive in theDockerfile. Each subsequent declaration in the Dockerfile modifies this parentimage. Most Dockerfiles start from a parent image, rather than a base image.However, the terms are sometimes used interchangeably.A base image has
FROM scratch
in its Dockerfile.
With Windows 10 introducing WSL2 you can now run Docker image from Ubuntu running via WSL2 that’s connected to your Host’s Docker Desktop app. That’s just insane! It’s inception in OS level. Today we will take a look at how to turn on this integration, so you can run Docker inside Ubuntu that’s running inside Windows 10 via WSL2. Aug 18, 2020 Installing Ubuntu. From your CLI run the following command: 👉 docker pull ubuntu. This will download the latest official Ubuntu image available. Next, we will create a Docker container running this Ubuntu image by entering this command: 👉 docker run -i -t ubuntu /bin/bash. The command will start the container, and you will then be. How to pull a Docker image on Ubuntu. The “docker pull” command is used to download a Docker image to your Ubuntu system. For instance, we have searched for the “ubuntu” image, and we found out that it is available on Docker Hub. Now, to download the “ubuntu” image, we will execute the “docker pull” command in the following way.
This topic shows you several ways to create a base image. The specific processwill depend heavily on the Linux distribution you want to package. We have someexamples below, and you are encouraged to submit pull requests to contribute newones.
Create a full image using tar

In general, start with a working machine that is runningthe distribution you’d like to package as a parent image, though that isnot required for some tools like Debian’sDebootstrap, which you can alsouse to build Ubuntu images.
It can be as simple as this to create an Ubuntu parent image:
Ubuntu
There are more example scripts for creating parent images in the DockerGitHub repository.
Create a simple parent image using scratch
You can use Docker’s reserved, minimal image, scratch
, as a starting point forbuilding containers. Using the scratch
“image” signals to the build processthat you want the next command in the Dockerfile
to be the first filesystemlayer in your image.

While scratch
appears in Docker’s repository on the hub, you can’t pull it,run it, or tag any image with the name scratch
. Instead, you can refer to itin your Dockerfile
. For example, to create a minimal container usingscratch
:
Assuming you built the “hello” executable example by using the source code athttps://github.com/docker-library/hello-world,and you compiled it with the -static
flag, you can build this Dockerimage using this docker build
command:
Don’t forget the .
character at the end, which sets the build context to thecurrent directory.
Note: Because Docker Desktop for Mac and Docker Desktop for Windows use a Linux VM,you need a Linux binary, rather than a Mac or Windows binary.You can use a Docker container to build it:
To run your new image, use the docker run
command:
Install Ubuntu Desktop
This example creates the hello-world image used in the tutorials.If you want to test it out, you can clonethe image repo.
More resources
There are lots of resources available to help you write your Dockerfile
.
- There’s a complete guide to all the instructions available for use in a
Dockerfile
in the reference section. - To help you write a clear, readable, maintainable
Dockerfile
, we’ve alsowritten aDockerfile
best practices guide. - If your goal is to create a new Docker Official Image, read Docker Official Images.
Comments are closed.