I am starting some work using Docker containers and as usual I like to spend some time refreshing and checking all is well before starting the actual development. Such approach seems to allow me to catch up issues before they cause bugs during the software development cycle.
Last year I wrote a post with the instructions I followed while installing Docker on my CentOS 7 Linux machine. If you are about to install Docker, their website appears to have up to data instructions for different operating systems.
Docker has two versions, Docker Engine Enterprise Edition (Docker EE) and Community Edition (CE). I have installed in my system Docker CE.
Docker has three types of update channels, stable, test and nightly.
* Stable gives you latest releases for general availability.
o Test gives pre-releases that are ready for testing before general availability.
o Nightly gives you latest builds of work in progress for the next major release.
I prefer the stable version. Living on the edge of technology does not tickle my fancy.
You can install Docker CE in different ways, depending on your needs:
* Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach and the one I followed.
o Some users download the RPM package and install it manually and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.
o In testing and development environments, some users choose to use automated convenience scripts to install Docker.
I used the following command to set up the stable repository:
$ sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
My docker-ce.repo looks as follows:
$ cat docker-ce.repo [docker-ce-stable] name=Docker CE Stable - $basearch baseurl=https://download.docker.com/linux/centos/7/$basearch/stable enabled=1 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-stable-debuginfo] name=Docker CE Stable - Debuginfo $basearch baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/stable enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-stable-source] name=Docker CE Stable - Sources baseurl=https://download.docker.com/linux/centos/7/source/stable enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-edge] name=Docker CE Edge - $basearch baseurl=https://download.docker.com/linux/centos/7/$basearch/edge enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-edge-debuginfo] name=Docker CE Edge - Debuginfo $basearch baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/edge enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-edge-source] name=Docker CE Edge - Sources baseurl=https://download.docker.com/linux/centos/7/source/edge enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-test] name=Docker CE Test - $basearch baseurl=https://download.docker.com/linux/centos/7/$basearch/test enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-test-debuginfo] name=Docker CE Test - Debuginfo $basearch baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/test enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-test-source] name=Docker CE Test - Sources baseurl=https://download.docker.com/linux/centos/7/source/test enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-nightly] name=Docker CE Nightly - $basearch baseurl=https://download.docker.com/linux/centos/7/$basearch/nightly enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-nightly-debuginfo] name=Docker CE Nightly - Debuginfo $basearch baseurl=https://download.docker.com/linux/centos/7/debug-$basearch/nightly enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg [docker-ce-nightly-source] name=Docker CE Nightly - Sources baseurl=https://download.docker.com/linux/centos/7/source/nightly enabled=0 gpgcheck=1 gpgkey=https://download.docker.com/linux/centos/gpg
Before installing, as directed, I checked the OS requirements. You can find this at the Docker site or my previous post.
Something that you may want to check and for sanity reasons eliminate the need to enter sudo before each docker command is to add your user name to the docker group. This is also illustrated in my previous post.
Let’s see if my user name: john_canessa has already been added to the docker group. You may do this as follows:
$ groups johncanessa wheel docker or $ id -Gn johncanessa wheel docker $ cut -d: -f1 /etc/group | sort abrt adm audio avahi bin cdrom cgred chrony colord daemon dbus dialout dip disk docker <=== created by Docker floppy ftp games gdm geoclue gluster gnome-initial-setup input johncanessa <=== that's me kmem kvm libstoragemgmt libvirt lock lp mail man mem nfsnobody nobody ntp oprofile pcp polkitd postdrop postfix printadmin pulse pulse-access pulse-rt qemu radvd root rpc rpcuser rtkit saned saslauth setroubleshoot slocate sshd ssh_keys stapdev stapsys stapusr sys systemd-journal systemd-network tape tcpdump tracing tss tty unbound usbmuxd users utempter utmp video wheel $ getent group docker docker:x:984:johncanessa
Based on the previous commands, it seems that I am in the docker group.
Let’s start Docker:
$ service docker restart Redirecting to /bin/systemctl restart docker.service
We can now verify the version of Docker we are running:
$ docker version Client: Version: 18.09.2 API version: 1.39 Go version: go1.10.6 Git commit: 6247962 Built: Sun Feb 10 04:13:27 2019 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 18.09.2 API version: 1.39 (minimum version 1.12) Go version: go1.10.6 Git commit: 6247962 Built: Sun Feb 10 03:47:25 2019 OS/Arch: linux/amd64 Experimental: false
It seems like the engine and client are alive. The versions are from this month. All is well so far.
I have read that while developing software it is not a bad idea to run Linux in permissive mode. Before you post the code you can change the mode back to Enforcing. I prefer to always run on Enforcing. The following screen capture illustrates finding and changing the current mode:
$ sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing <=== Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Max kernel policy version: 31 $ getenforce Enforcing $ sudo setenforce 0 $ getenforce Permissive $ sudo setenforce 1 $ getenforce Enforcing
If you are interested in reading more about Security-Enhanced Linux (SELinux) you can do it here.
In my previous post I note that one of the requirements to run Docker is to have a 64-bit platform. To check that you could:
$ uname -r 3.10.0-957.5.1.el7.x86_64 $ uname -m x86_64 $ uname -a Linux ceph1 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Note that the results of the last command are slightly different from the last time I ran the same command in my previous post. The reason for this is that I installed ceph software on my machine to learn and experiment with it. I am planning on using ceph for a future project. To read more about ceph you could follow this link.
I do not see a point or need in posting anything related to this post on GitHub.
I will follow this post shortly with some experimentation using Docker. Until then, keep on learning, experimenting and having a great time with software development.
If you have comments or questions regarding this or any other post in this blog, please leave me a note bellow.
John
Follow me on Twitter: @john_canessa