Convert Docker image to Google Compute Engine VM image - docker

I have a Docker image (in Ubuntu 14.04 environment) that I want to upload to Google Compute Engine and run as a Compute Engine (not App Engine) instance.
There is a presentation (by Google's Marc Cohen) about how to do this but it leaves out key steps (on page 34) about how to convert the Docker image to raw tar.gz format.
Can someone tell me the exact steps to
convert Docker image to correct format
upload to google storage
create google compute engine image
start google compute engine instance

If you are not bound to your Ubuntu image, then you could just use the ready made VMs with Docker support (Debian Wheezy) and drop your containers in.
For more info on using Docker on GCE, see:
Container-optimized Google Compute Engine images
Containers on Google Cloud Platform

The documentation on packaging has comprehensive steps to do all what you have enumerated.
There are some specific requirements that your install must include in order for it to be compatible with GCE; its a long list of kernel compatibility flags, disk types, NTP settings, etc. etc. so copy-pasting it here will not be prudent as this information is likely to change as GCE is updated by Google.

Related

How can I create a Docker image from ISO?

Unfortunately, I'm in an environment where I have to use CentOS 4.8 for business reasons.
I'd like to create an image in Docker to manage this horrible old version of OS.
I checked that some users put the image on the Docker Hub, and I checked that some images are working normally.
And the question here is, how did they create these images? Is it possible to create an image by ISO itself, or by other means, rather than an image derived from the official image distributed by Docker? (Official image exists from CentOS 5 version onwards)
and I've found that I can extract Ubuntu images from ISO through searching.
However, there is no talk of CentOS and RHEL clone OSs.
Thank you.

Windows based containers on google cloud run

I am trying to understand what containers are supported by google cloud run.
One place in its key features are:
https://cloud.google.com/run/?hl=sr#all-features
"Any language, any library, any binary Use the programming language of
your choice, any language or operating system libraries, or even bring
your own binaries."
In another place, it says:
https://cloud.google.com/run/docs/reference/container-contract
Supported languages and images
Your container image can run code written in the programming language
of your choice and use any base image, provided that it respects the
constraints listed in this page.
Executables in the container image must be compiled for Linux 64-bit.
Cloud Run specifically supports the Linux x86_64 ABI format.
I am really confused.
Right now, Cloud Run doesn't support Windows images, it only supports Linux based containers, but Google Kubernetes Engine (GKE)now has support for windows docker based containers.
Google offers a codelab in 2 parts (part1 GCE |part2 GKE) to create windows docker containers and to use it on Compute engine (GCE) and GKE, these are the only 2 GCP products that supports windows docker images.
The main idea is create a Docker image, push this to Google Container registry and use this to create a GKE infrastructure using windows images.
The container is 64-bit Linux container. You can create any container that is compatible with that ABI. Within that container, you can do whatever you like, as long as it adheres to the container runtime contract.

how to save google instance setup as docker image?

I work on VM on google cloud for my Machine learning work.
In order to avoid installing all the libraries and module from scratch every time I create a new VM on GCP or whatever, I want to save the VM that I created on Google Cloud and save on GitHub as a docker image. So that next time, I would just load it and run it as a docker image and get my VM ready for work.
Is this a straightforward task? Any ideas on how to do that, please?
When you create a Compute Engine instance, it is built from an artifact called an "image". Google provides some OS images from which you can build. If you then modify these images by (for example) installing packages or performing other configuration, you can then create a new custom image based upon your current VM state.
The recipe for this task is fully documented within the Compute Engine documentation here:
https://cloud.google.com/compute/docs/images/create-delete-deprecate-private-images
Once you have created a custom image, you can instantiate new VM instances from these custom images.

Minimal Ubuntu docker image is claimed to be 29MB, so why does "docker images" command say 84.1MB?

https://blog.ubuntu.com/2018/07/09/minimal-ubuntu-released
says
The 29MB Docker image for Minimal Ubuntu 18.04 LTS serves as a highly
efficient container...
...
On Dockerhub, the new Ubuntu 18.04 LTS image is now the new Minimal
Ubuntu 18.04 image. Launching a Docker instance with docker run
ubuntu:18.04 therefore launches a Docker instance with the latest
Minimal Ubuntu.
I ran the exact command mentioned:
docker run ubuntu:18.04
Then I ran "docker images" which said:
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 18.04 16508e5c265d 5 days ago 84.1MB
Why does that output say 84.1MB? The Ubuntu web page I quoted says it should be 29MB.
Am I doing something wrong?
Am I measuring the size incorrectly?
How can I get an Ubuntu image that's only 29MB?
The article states that Docker Hub hosts a "standard" image, which is bigger than the cloud image. The cloud image is the new thing they introduced and it weighs 29MB while the standard image weighs 32MB.
The cloud image is not available on Docker Hub.
But still, where did the 84MB come from? It's because you are downloading a compressed image from the registry. Which, in this case, only weighs 32MB. Once downloaded, it's decompressed into its usable format and stored locally on your machine.
Meaning everything is in order. Where do you get that cloud image from? Well, I'd start by looking at:
[...] are available for use now in Amazon EC2, Google Compute Engine (GCE) [...]
If you'd like to use it with a private cloud, this is where you download the image from link to Ubuntu Minimal Cloud Images
-edit-
addressing your comment, those private cloud sizes may vary. This is at least partially, if not mostly, due to differences between various hypervisor stacks. As is hinted at in the article:
Cloud images also contain the optimised kernel for each cloud and supporting boot utilities.
--
Just as an update, these days (~three years later), the latest 18:04 image weighs 25MB in its compressed format, so the exact numbers from my original answer are no longer valid, but the point is still valid.

How does it possible that Ubuntu image has only ~100MB?

I can't understand one thing. I read about images and AUFS file system and I think that I got it. However, when I look at iso file on ubuntu site it is meaningfully more than 100MB. Where is key ? In graphical enviroment? (eg. KDE)
Docker Images are minimal meaning, they contain only a few number of libraries (needed libraries). They don't include kernel, because containers use docker host's kernel.
You can download and inspect official ubuntu cloud image (source of library/ubuntu yekkety) from here.
Another thing to note: Base images usually don't include window managers and desktop environments.

Resources