Docker - Linux Container (Ubuntu, Redhat, ...)

> Virtualization - (Virtual Machine|Container) > Docker

1 - About

Advertising

3 - Example Running Ubuntu with Docker

  • Run it
## docker run -it $(CONTAINER_NAME) bash
$ docker run -it ubuntu bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu

6bbedd9b76a4: Pull complete
fc19d60a83f1: Pull complete
de413bb911fd: Pull complete
2879a7ad3144: Pull complete
668604fde02e: Pull complete
Digest: sha256:2d44ae143feeb36f4c898d32ed2ab2dffeb3a573d2d8928646dfc9cb7deb1315
Status: Downloaded newer image for ubuntu:latest
  • Test it
echo $SHELL
/bin/bash

4 - Management

4.1 - Base

5 - Distribution

5.1 - Ubuntu

  • Update it because the ubuntu image is minimal
apt-get update
  • And install what you want
apt-get install wget
apt-get install vim
Advertising

5.2 - Redhat

Redhat use its own registry: Redhat container catalog.

Get base Image from the RedHat Registry with docker:

# Minimu Size
# https://access.redhat.com/containers/?tab=overview&platform=docker#/registry.access.redhat.com/rhel7-atomic
docker pull registry.access.redhat.com/rhel7-atomic
# Full
# https://access.redhat.com/containers/?tab=overview&platform=docker#/registry.access.redhat.com/rhel7.5
docker pull registry.access.redhat.com/rhel7.5

Then: Example starting Redhat with mounting the actual current directory to /wd with the cmder console

SOURCE_MOUNT_POINT=$(cygpath -u $(readlink -f .))
docker run  \
    --mount type=bind,source=/$SOURCE_MOUNT_POINT,target=/wd \
    -rm \
    -it \
    registry.access.redhat.com/rhel7 \
    bash

Then:

yum update>
yum install wget
yum install vim