---
title: Deploy Container on Ubuntu Pro on Google Cloud
description: Since I wrote Launch Ubuntu Desktop on Google Cloud last week, I kept
  thinking about putting Ubuntu Desktop into containers. A container is an independent
  unit of software packages and their dependencies so that the application on the
  container can run reliably in different computing environments. Docker, an open-source
  project launched i […]
url: https://canonical.com/blog/deploy-container-on-ubuntu-pro-on-google-cloud?format=md
---

1. [Blog](https://canonical.com/blog)
2. Article

---

[Hugo Huang](https://canonical.com/blog/author/hugohuangtao "More about Hugo Huang")

6 December 2021

# Deploy Container on Ubuntu Pro on Google Cloud

[containers](https://canonical.com/blog/tag/containers)
[docker](https://canonical.com/blog/tag/docker)
[Google Cloud](https://canonical.com/blog/tag/google-cloud)
[Ubuntu Pro](https://canonical.com/blog/tag/ubuntu-pro)

---

Share the article

Since I wrote [Launch Ubuntu Desktop on Google Cloud](https://ubuntu.com/blog/launch-ubuntu-desktop-on-google-cloud) last week, I kept thinking about putting Ubuntu Desktop into containers. A container is an independent unit of software packages and their dependencies so that the application on the container can run reliably in different computing environments. [Docker](https://www.docker.com/), an open-source project launched in 2013, made Container technology popular all over the world in just a few years. Why? Let’s compare Containers and Virtual Machines.

The fundamental difference between Virtual Machine and Container is that Containers do not contain a guest Operating System. Containers virtualize the operating system instead of hardware, hence are more portable and efficient. Multiple containers can run on the same machine and share the same OS kernel with other containers. That being said, Containers are much smaller than VMs. You can run 4-6 times as many containers as VMs in the same physical machine.

However, Docker didn’t invent Container, instead, Docker built its technology base on [LXC](https://linuxcontainers.org/), a method of containerization developed by Canonical in 2008.

In this tutorial, we will create a Docker Container on the latest Ubuntu Pro 20.04 by following 3 steps:

1. Launch a Ubuntu VM instance on Google Cloud to host Containers.
2. Install Docker.
3. Pull a Docker Image and run the container.

## Launch a Ubuntu VM to host Containers

In this step, we will launch a VM instance in Google Cloud. The default e2-medium (2 vCPU, 4 GB memory) machine type works fine for the tutorial purpose. If you want a more performant machine, there are a variety of choices in Google Cloud.

1. In the [Google Cloud Console](https://console.cloud.google.com/), go to the [VM Instances](https://console.cloud.google.com/compute/instances) page:

2. Click CREATE INSTANCE.

3. Set the instance name to *ubuntu-container-host* .

4. Select a region and zone you want to run your instance.

5. Scroll down to the Boot disk options and click Change

6. In the Boot disk pop-up window, in Operating System, select Ubuntu Pro from the drop-down; in Version, select Ubuntu-Pro-20.04-LTS; keep the rest options as default value and click SELECT. [Ubuntu Pro](http://ubuntu.com/gcp/pro) ensures the latest security update, which will be useful when we install the productivity applications.

7. Click CREATE to create the instance.

8. In less than one minute, you will be able to see your Ubuntu instance in RUNNING status. You can click the SSH button in the instance list to connect to your new instance.

If you prefer to start a VM through Google Cloud Shell, you can use this command to achieve the same result:

```
gcloud compute instances create ubuntu-container-host --zone=us-central1-a --machine-type=e2-medium --image=projects/ubuntu-os-pro-cloud/global/images/ubuntu-pro-2004-focal-v20210720
```

## Install Docker

In Ubuntu, the easiest way to install Docker is to snap. A snap is a bundle of an app and its dependencies that works without modification across many different Linux distributions. Snaps are discoverable and installable from the Snap Store, an app store with an audience of millions.

1. In the SSH window connected to your VM instance, update the package manager data and install Docker

```
sudo apt update
sudo snap install docker
```

That’s it! Snap makes installation so easy.

## Pull a Docker Image and run the container

Let’s first search for ubuntu images.

```
sudo docker search ubuntu
```

We found a lot of ubuntu related images:

```
NAME                                                      DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                                                    Ubuntu is a Debian-based Linux operating sys…   13254     [OK]
dorowu/ubuntu-desktop-lxde-vnc                            Docker image to provide HTML5 VNC interface …   590                  [OK]
websphere-liberty                                         WebSphere Liberty multi-architecture images …   282       [OK]
```

[OK] means that the image was built and supported by a company. We will pull the latest official Ubuntu Image

```
sudo docker pull ubuntu
```

```
Using default tag: latest
latest: Pulling from library/ubuntu
7b1a6ab2e44d: Pull complete
Digest: sha256:626ffe58f6e7566e00254b638eb7e0f3b11d4da9675088f4781a50ae288f3322
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest
```

Check the images we downloaded to this VM instance:

```
sudo docker images
```

```
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
ubuntu       latest    ba6acccedd29   7 weeks ago   72.8MB
```

Let’s run a container based on this official Ubuntu image.

```
sudo docker run -it ubuntu
root@81046dba57f4:/#
```

In this container, we can check if it is the latest version of ubuntu:

```
cat /etc/lsb-release
```

```
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
```

Yes, it is the latest version. Let’s install python into this container.

```
apt update
apt install python3
```

Check the version we installed:

```
/usr/bin/python3 -V
```

```
Python 3.8.10
```

Since we modify the original Ubuntu image, we want to save the changes to new images. We click “Ctrl + P” and “Ctrl + Q” to exit the container interface and back the VM.

```
sudo docker ps
```

```
CONTAINER ID   IMAGE     COMMAND   CREATED          STATUS          PORTS     NAMES
81046dba57f4   ubuntu    "bash"    21 minutes ago   Up 21 minutes             bold_sammet
```

We commit the changes to a new Docker image:

```
sudo docker commit -m "installed python3" -a "hugo" 81046dba57f4
```

-m with parameter “installed python3″ indicates the changes made to this image.

-a with parameter “hugo” indicates that I am the author of these changes.

```
sudo docker images
```

```
REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
<none>       <none>    2316816463ea   16 seconds ago   144MB
ubuntu       latest    ba6acccedd29   7 weeks ago      72.8MB
```

That’s it. We made a Docker Container Image on Ubuntu Pro on Google Cloud.

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

By submitting this form, I confirm that I have read and agree to [Canonical's Privacy Policy](https://canonical.com/legal/dataprivacy).

Sign up

## Share on

---

## Related posts

[### Arduino® VENTUNO™ Q is available for pre-order with Ubuntu pre-installed](https://canonical.com/blog/arduino-ventuno-q-is-available-for-pre-order-with-ubuntu-pre-installed)

London, UK – August 25, 2026 – Following our initial collaboration announcement in March 2026, Canonical and Arduino (a subsidiary of Qualcomm Technologies, Inc.) are excited...

[Canonical](https://canonical.com/blog/author/canonical)

25 August 2026

[### Canonical announces the Enterprise Store as part of Ubuntu Pro](https://canonical.com/blog/canonical-announces-the-enterprise-store)

Canonical introduces a new way to manage software behind firewalls and in air-gapped environments with the Enterprise Store. The Enterprise Store makes software distribution...

[Holly Hall](https://canonical.com/blog/author/hollyhall)

21 July 2026

[### Tracing a memory leak bug in PID 1 and contributing an upstream fix: a Linux support story](https://canonical.com/blog/fixing-memory-bug)

How Canonical Support helped a global retail organization trace the cause for an unusual memory leak originating in PID 1. By investigating the issue across three separate...

[Lidia Luna Puerta](https://canonical.com/blog/author/lidia-luna)

17 July 2026

[### Ubuntu and Ubuntu Pro on Azure Cobalt 200 VMs](https://canonical.com/blog/ubuntu-azure-cobalt-200-vms)

Microsoft has announced the preview of Azure Cobalt 200, its second-generation custom Arm silicon. Learn how Ubuntu and Ubuntu Pro support these new VMs from day one, offering...

[Jehudi](https://canonical.com/blog/author/jota-ce)

2 June 2026
