Showing posts with label containers. Show all posts
Showing posts with label containers. Show all posts

Jan 29, 2020

Instant Fresh openSUSE Tumbleweed with Docker and Vagrant Images

On my machines I run openSUSE Leap (download), a stable distribution that follows the SUSE Linux Enterprise service packs. But frequently my task is to reproduce or fix a bug in openSUSE Tumbleweed (download), the hottest rolling distribution.

In the past, I would take an ISO image of the installation DVD and install a virtual machine from scratch. (To say nothing about burning a CD, copying a boot floppy, and reinstalling a physical machine. I've been doing this for too long.)

Fortunately, things got easier with ready-made disk images for containers (Docker/Podman) and virtual machines (Vagrant).

With Docker

Get the latest Tumbleweed image from the Docker hub:

$ docker pull opensuse/tumbleweed

Run it:

$ docker run -it opensuse/tumbleweed bash
8484d09e2380:/ # grep VERSION_ID /etc/os-release
VERSION_ID="20200118"
8484d09e2380:/ # ...
...
8484d09e2380:/ # exit

Clean up, removing the container or even the Tumbleweed image:

$ docker ps -a
CONTAINER ID   IMAGE               COMMAND  CREATED          STATUS                     PORTS NAMES
8484d09e2380   opensuse/tumbleweed "bash"   58 minutes ago   Exited (127) 9 seconds ago       hungry_northcutt
$ docker rm 8484d09e2380
8484d09e2380
$ docker rmi opensuse/tumbleweed:latest 

With Vagrant

Vagrant virtual machines work with a context directory and a config file, so let's create them:

$ mkdir vagrant-tw-test; cd $_
$ vagrant init opensuse/Tumbleweed.x86_64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` [...]

The up step downloads the base image ("box") that we declared previously, and brings up our VM instance. The ssh step connects there.

$ vagrant up
[...]
$ vagrant ssh
> grep VERSION_ID /etc/os-release 
VERSION_ID="20200114"
> ...
...
> exit

Clean up:

$ vagrant halt     # stop the VM
$ vagrant destroy  # remove its disk image
$ vagrant prune    # remove the box (base image)

See details in Meike Chabowski's article Vagrant Boxes with openSUSE Tumbleweed.