Skip to content

Instantly share code, notes, and snippets.

What would you like to do?



Docker Hub

Using Docker

  • Image names: user/name:tag (user is missing for the official Docker images, tag is usually the version)

Base Images

  • docker run -it opensuse bash (equals to opensuse:latest, which is 42.2, use opensuse:tumbleweed for the TW)
  • docker run -it fedora:25 bash
  • docker run -it ubuntu:14.04 bash
  • docker run -it alpine sh minimal busybox system (~4MB)


  • docker run -it -p 8080:80 nginx open http://localhost:8080
  • docker run -it -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123 mysql connect via mysql -h -u root -p or shutdown via mysqladmin -h -u root -p shutdown

YaST Images

Image Rebuild

Travis Integration

The Snapper Trick

Snapper is built for different 5 distributions in Travis.

Basic Docker Commands

  • Installing Docker: zypper in docker && systemctl start docker or see if you want the latest version from a 3rd party repo
  • All following commands require root
  • docker build -t <tag> . builds an image (the last arg is a dir with Dockerfile)
    • The build steps are cached
  • docker run -it <image> <command> start a new container (-i interactive, -t use a TTY)
  • see man docker-run
  • docker images prints available images
  • docker ps prints containers (-a also stopped)

Docker Tips&Tricks

  • docker commit save result of a stopped container
  • docker run --rm deletes the result
  • CTRL-p CTRL-q detach (in TTY mode)
  • docker attach <container> attach
  • docker top <container>
  • docker stats <container>
  • docker rm <container> remove container
  • docker rmi <image> remove image
  • docker images -q --filter "dangling=true" | xargs docker rmi remove unused images
  • docker rm `docker ps -a -q` removes all containers
  • docker rmi `docker images -q` removes all images


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.