The wikis are now using the new authentication system.
If you did not migrate your account yet, visit https://idp-portal-info.suse.com/

User:Tsu2/docker

Jump to: navigation, search
Icon-warning.png

This page has been deprecated. Current Installation instructions for all versions of openSUSE and SLES/SLED is now at https://en.opensuse.org/User:Tsu2/Docker_Install. Currently, all content on this page except for adding a repository is still valid, A User can use this page a tutorial for "First Steps" launching your first container.

.



Installing Docker on openSUSE

This page is intended to be an improvement on official Docker/openSUSE documentation at the docker site
Docker.com - openSUSE

Some comments: The original documentation uses the "very un-openSUSE" practice invoking sudo with every command. The revised commands on this page are intended to be run from a proper root console ("su" to root).

Brief Docker description

Docker is a powerful way to deploy Linux Containers as a cross-platform PaaS. As of this writing, a different implementation of Linux Containers called LXC can also be implemented on openSUSE through YAST, but the cross-platform promise of plain LXC was never properly fulfilled. Docker today resolves numerous LXC issues so that you can now quickly and easily deploy practically any openSUSE version or any other distro running simultaneously on your openSUSE host without any overhead normally associated with virtualized Guests like VMware, VBox, KVM, Hyper-V, etc.

Install, start and enable Docker to run as a service

The following installs, starts and enables Docker to run as a service (starts on boot) as one command

zypper in docker && systemctl start docker && systemctl enable docker

By default, only root can launch Docker containers.

If for some reason you wish to relax permissions to launch docker apps with a non-privileged account you can run the following command which adds your specified User to the Docker User Group(I personally do not recommend)

usermod -a -G docker <username>

Launching some Containers

Before proceeding, a short note and comment about Docker networking...
Unlike every other virtualization technology today which builds on a fairly standard model where you create a different bridge device for each virtual network, Docker instead uses a single Linux Bridge Device that can be configured to function in a variety of "modes." By default the Container is setup in a NAT configuration where the container is assigned an address 172.x.y.z/16. My initial impression is that in this configuration, no outbound ports are blocked but all inbound are blocked unless pinhole port mappings are configured between the Host and Container. I have found that in this configuration DNS name resolution (/etc/resolv.conf) within the Container is not always configured properly but can be addressed with the optional command line setting "--dns="

For simplicity only, the following commands instead configure the Container to share the same networking stack as the Host by using the optional flag "net=host" which may have security implications so may not be recommended for common practice.

All of the following examples launch a container configured with the following
-i interactive
-t instantiating a console you can use within the container
--rm Automatically destroys/removes the created container on exit
--net Designating a type of network mode. Currently Docker uses a single Linux Bridge Device that can be configured to function in a variety of "modes,' unlike typical virtual technologies which allow you to create different bridge devices for various network configurations.

The following downloads the latest Ubuntu image (only on first run, then is stored for later use) and drops you into a bash shell in the container (type "exit" to exit)

docker run -i -t --net=host ubuntu /bin/bash

The following command creates and runs an openSUSE 12.3 container, even if the Host is openSUSE 13.1 or something else

docker run -i -t --net=host salttest/opensuse-12.3 /bin/bash

The following will run the latest available openSUSE version. I expect when 13.2 (and later) is released, that will automatically install. As of this writing, 13.1 is current. From the official openSUSE sources

docker run --rm -i -t --net=host opensuse /bin/bash

Verify your Container environment

After launching any of the above containers, the following command displays information about your running environment including the distro name and version. Compare running this command in any container and in your HostOS.

cat /etc/release*

Of course, you can run multiple instances of any other distro including openSUSE (even older or newer versions) on your new openSUSE running Docker by simply specifying the distro by name and optionally a tag specifying the version.

Exiting the running Container

Note that the following only exits from the console running from within the container (the above commands invoked containers and also specified /bin/bash). The container will continue to run until you issue the Docker stop command or you shut down the Host.

exit

Related Info

Access the Docker Container Console