H4KAt

          Why do you never see elephants hiding in trees?
          They're really good at it.

Docker notes
------------

INSTALLING CENTOS
.................

Installing Centos 7.3 from minimal ISO:

  + confirm partitioning (click and [Done])
  + Network: enp0s3 [On], hostname [CBOX]
  + root Password: (short weak fear good strong)
      Press [Done] twice to use weak password anyway
  + create user: virtu, [v] make this user administrator
                        (to work with sudo immediately)

  # yum upgrade
  # cat /etc/ssh/sshd_config | grep ^Port
  Port 22
  # systemctl restart sshd.service

..to reach a CentOS7 Minimal Desktop Installation you can do following steps [2]:

  # yum groupinstall "X Window System"
  # yum install gnome-classic-session gnome-terminal \
                nautilus-open-terminal control-center \
                liberation-mono-fonts
  # unlink /etc/systemd/system/default.target
  # ln -sf /lib/systemd/system/graphical.target \
           /etc/systemd/system/default.target
  # yum install -y gcc g++ kernel-devel
  # reboot

Insert Guest Additions media

  # cd /run/media/virtu/VBOXADDITIONS_5.1.18_114002/
  # ./VBoxLinuxAdditions.run

Cleaning..

  # cd ~
  # yum clean all
  # dd if=/dev/zero of=biig; rm biig

Docker on Centos:
.................

Prerequisites: Docker CE is supported on CentOS 7.3 64-bit.
               # rpm --query centos-release
               centos-release-7-3.1611.el7.centos.x86_64

1. Set up the repository

  Set up the Docker CE repository on CentOS:

    $ sudo yum install -y yum-utils

    $ sudo yum-config-manager \
      --add-repo \
      https://download.docker.com/linux/centos/docker-ce.repo

    $ sudo yum makecache fast

2. Get Docker CE

  Install the latest version of Docker CE on CentOS:

    sudo yum -y install docker-ce

  Start Docker:

    $ sudo systemctl start docker

3. Test your Docker CE installation

  Test your installation:

    $ sudo docker run hello-world

  To try something more ambitious, you can run an Ubuntu container with:

    $ sudo docker run -it ubuntu bash

In Ubuntu container
...................

  # apt-get update
  # apt-get install net-tools
  # ifconfig
  # apt-get install nano gcc
  # cat hello.c
    #include <stdio.h>
    int main() {
      printf("Hello, World\n");
      return 0;
    }
  # gcc hello.c -o hello
  # cp hello /usr/local/bin
  ^p^q
  centos# docker ps
  CONTAINER ID        IMAGE         COMMAND     CREATED
  STATUS              PORTS         NAMES
  a1189806bcbf        ubuntu        "bash"      2 minutes ago
  Up 2 minutes                      loving_nightingale

  centos# docker commit a1189806bcbf minuubuntu
  sha256:6b4697b1ae00b712c60a1b0420b71b051e5741d6bf3942b9ad30d16436a62b49

  centos# docker images
  REPOSITORY   TAG     IMAGE ID      CREATED             SIZE
  minuubuntu   latest  6b4697b1ae00  About a minute ago  157 MB
  ubuntu       latest  6a2f32de169d  8 days ago          117 MB
  hello-world  latest  48b5124b2768  3 months ago        1.84 kB

  centos# docker run -it minuubuntu:latest hello
  Hello, World

Crazy FAQ.
..........

1. What comes with # yum groupinstall "Development Tools"?

  yum groupremove "Development Tools"

  autoconf, automake, bison, byacc, cscope, ctags, diffstat, doxygen, \
  elfutils, flex, gcc, gcc-c++, gcc-gfortran, git, indent, intltool,  \
  libtool, patch, patchutils, rcs, redhat-rpm-config, rpm-build,      \
  rpm-sign, subversion, swig, systemtap

  gettext-devel, libquadmath-devel, perl-Git, systemtap-devel

2. What costs installing "Development Tools" vs gcc g++ kernel-devel

  7-Zipped VHD image is now 36MB smaller (572402KB vs 608027KB)

3. How to open Ubuntu GUI inside docker image

    http://stackoverflow.com/questions/40658095
         /how-to-open-ubuntu-gui-inside-docker-image

I have downloaded the ubuntu image inside the docker in Windows. I can run the ubuntu by

  docker run -it ubuntu

but i only see root, i dont see Ubuntu GUI, how to install or configure the GUI for that image and run apps on that GUI like we run in VM

  $apt-get --no-install-recommends install lubuntu-desktop
  startlxde
  Agent pid 4053
  ** Message: main.vala:99: Session is LXDE
  ** Message: main.vala:100: DE is LXDE
  (lxsession:4049): Gtk-WARNING **: cannot open display:

What's the use-case for needing the Ubuntu GUI from a docker container? Docker generally runs headless, so you could install X and run a VNC server or something I guess... but seems odd.

Docker images are supposed to run one app most typically a server or a compute app. Sometimes it gets to more that one app but usually not to serve the UI. UI needs lot more for which docker is not a good use case.

Use a VM then. This doesn't sound like an appropriate use of docker at all.

5. How to unlock Centos lock screen?

..hold down the left mouse button over the screen and move up.

  https://unix.stackexchange.com/questions/224440
        /centos-lock-screen-not-unlocking

6. How to install "ifconfig" command in my ubuntu docker image?

    http://stackoverflow.com/questions/42870005
         /how-to-install-ifconfig-command-in-my-ubuntu-docker-image

  $ ifconfig # VirtualBox nat network. Host 10.0.2.15

  eth0      Link encap:Ethernet  HWaddr 02:42:ac:11:00:02
            inet addr:172.17.0.2

7. If there is no network connection on Centos VM:

  # dhclient enp0s3

8. If sudo inaccessible

  [root@CBOX ~]# cat /etc/group | grep virtu
  wheel:x:10:virtu
  virtu:x:1000:virtu

Links
-----

1. https://www.rosehosting.com/blog
         /how-to-configure-and-use-openssh-on-centos-7/

2. https://www.centos.org/forums/viewtopic.php?t=47088

3. http://www.diogogmt.com/2015/09/19
        /installing-build-essentials-on-centos-7-and-ubuntu-14-03/

4. https://stefanscherer.github.io
         /run-linux-and-windows-containers-on-windows-10/

5. Commit and create derived container

  https://www.liquidweb.com/kb/how-to-commit-changes-to-docker

