Install docker on RedHatLinux 6.7 - docker

I am following the documentation https://docs.docker.com/engine/installation/rhel/ to install docker on RHEL 6.7.
When I run the command
sudo yum install docker-engine
I get the following error
Error: Package: docker-engine-1.9.1-1.el7.centos.x86_64 (dockerrepo)
Requires: libsystemd-journal.so.0(LIBSYSTEMD_JOURNAL_196)(64bit)
Error: Package: docker-engine-1.9.1-1.el7.centos.x86_64 (dockerrepo)
Requires: libsystemd-journal.so.0(LIBSYSTEMD_JOURNAL_195)(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
As per the suggestion I tried to run the command
sudo yum install docker-engine --skip-broken
Here is the output
Packages skipped because of dependency problems:
audit-libs-python-2.3.7-5.el6.x86_64 from RHEL-67-x86_64
docker-engine-1.9.1-1.el7.centos.x86_64 from dockerrepo
docker-engine-selinux-1.9.1-1.el7.centos.noarch from dockerrepo
libsemanage-python-2.0.43-5.1.el6.x86_64 from RHEL-67-x86_64
policycoreutils-python-2.0.83-24.el6.x86_64 from RHEL-67-x86_64
setools-libs-3.3.7-4.el6.x86_64 from RHEL-67-x86_64
setools-libs-python-3.3.7-4.el6.x86_64 from RHEL-67-x86_64
How can I fix above problems and install docker on RHEL 6.7 ?

RHEL 6 is no longer supported by Docker, the latest version you can install is Docker 1.7. The installation instructions can be found here

Below steps do work for Docker to be installed on OEL 6.10 with a user having super user privileges.
Create a user with SUDO Access as suggested in Red-Hat Docs ([Link][1] speaks well on this process). For instance I created an user as docker with group as docker.
groupadd docker
useradd -m -g docker docker
Add docker repository for installing latest copy of Docker for RHEL/Centos 6
yum update -y
yum install epel-release
vi /etc/yum.repos.d/docker.repo
Add below contents to /etc/yum.repos.d/docker.repo
[docker-repo]
name=Docker Repo
baseurl=https://yum.dockerproject.org/repo/main/centos/6/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
Switch to "docker" user and execute below commands:
sudo yum install -y docker-engine
Post Installation start docker using below commands.
sudo chkconfig docker on
sudo service docker start
Starting cgconfig service: [ OK ]
Starting docker: [ OK ]
sudo service docker status
docker (pid 26925) is running...
ps -ef | grep docker
root 25590 14123 0 Jul27 ? 00:00:00 sshd: docker [priv]
docker 25594 25590 0 Jul27 ? 00:00:00 sshd: docker#pts/1
docker 25595 25594 0 Jul27 pts/1 00:00:00 -bash
root 26925 1 2 00:00 pts/1 00:00:00 /usr/bin/docker -d
docker 27106 25595 0 00:00 pts/1 00:00:00 ps -ef
docker 27107 25595 0 00:00 pts/1 00:00:00 grep docker
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[1]: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/2/html/Getting_Started_Guide/ch02s03.html

You can install the last version of Docker by upgrading your Kernel to 3.10. At your own risk :)
Worked for me and pretty stable for weeks now.
Upgrading RHEL Kernel

For me was useful this link. I have an oracle server 6.10 and the steps are:
add epel packages: rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
update packages: yum update -y
Install docker: yum install docker-io -y
Start service: /etc/init.d/docker start
Configure service in start machine: chkconfig docker on

Related

Unable to install docker on AWS Linux AMI

I followed the steps to install docker on my EC2 instance which is based on Amazon AMI using the instructions from the official link - official docker installation on centos. I am getting the below error.
$ sudo yum update
........
$ sudo yum install docker-ce docker-ce-cli containerd.io
........
--------> Finished Dependency Resolution
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: systemd
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: libsystemd.so.0(LIBSYSTEMD_209)(64bit)
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2:2.74
Error: Package: containerd.io-1.2.13-3.1.el7.x86_64 (docker-ce-stable)
Requires: systemd
Error: Package: 3:docker-ce-19.03.8-3.el7.x86_64 (docker-ce-stable)
Requires: libsystemd.so.0()(64bit)
Error: Package: containerd.io-1.2.13-3.1.el7.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2:2.74
Where am I going wrong?
Solution in context of the image - Amazon Linux 2 AMI
One may need to remove the packages they installed using docker provided links
use the command here to remove all of that:-
sudo rm /etc/yum.repos.d/docker-ce.repo
And use the link given by AWS to install the docker here - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html
The content for that commands in that link are as below:-
Connect to your instance(Amazon Linux 2 AMI).
Update the installed packages and package cache on your instance.
sudo yum update -y
Install the most recent Docker Community Edition package.
sudo amazon-linux-extras install docker
Start the Docker service.
sudo service docker start
Add the ec2-user to the docker group so you can execute Docker commands without using sudo.
sudo usermod -a -G docker ec2-user
Log out and log back in again to pick up the new docker group permissions. You can accomplish this by closing your current SSH terminal window and reconnecting to your instance in a new one. Your new SSH session will have the appropriate docker group permissions.
Verify that the ec2-user can run Docker commands without sudo.
docker info
Use amazon-linux-extras to install docker
# install
sudo rm /etc/yum.repos.d/docker-ce.repo # if you have already tried in the wrong way
sudo amazon-linux-extras install docker
# enable on boot and start daemon
sudo systemctl enable docker
sudo systemctl start docker
# correct permissions
sudo usermod -a -G docker $USER
newgrp docker
docker ps
Amazon AMI best practices are to use their install procedures. You, of course, are at your liberty to do what best fits your needs:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html
Figured it out because I had a similar issue an hour ago, and just realized I was doing it wrong:
https://serverfault.com/questions/836198/how-to-install-docker-on-aws-ec2-instance-with-ami-ce-ee-update
I installed docker using below link. May this be helping others
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html

Error running docker build for arm32v7 container on amd64 linux machine: standard_init_linux.go:207

I have an amd64 linux machine that I'm using to build an arm32v7 container. When docker build encounters the first RUN command, it errors out with:
standard_init_linux.go:207: exec user process caused "no such file or directory"
This can be easily reproduced without a docker file by running docker run -it arm32v7/ubuntu:xenial on an amd64 linux host.
I've seen this complaint elsewhere, but most advice is that you need to build an arm32v7 container on an arm32v7 host. This is fairly impractical.
I've had success on Ubuntu 19.04 and 18.10 adding some architecture emulation:
sudo apt-get install -y qemu qemu-user-static qemu-user binfmt-support
After adding these packages, the error goes away and I can create my arm32v7 container.
But, this does NOT work for Ubuntu 18.04 or 16.04.
Is there a general solution that works everywhere?
It seems that there are some post-install steps that are failing on Ubuntu 18.04 and 16.04.
Here are a couple workarounds that solve the problem on 18.04 and 16.04.
Method 1:
git clone https://github.com/computermouth/qemu-static-conf.git
sudo mkdir -p /lib/binfmt.d
sudo cp qemu-static-conf/*.conf /lib/binfmt.d
sudo systemctl restart systemd-binfmt.service
Method 2:
sudo mkdir -p /lib/binfmt.d
sudo sh -c 'echo :qemu-arm:M::\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xfe\\xff\\xff\\xff:/usr/bin/qemu-arm-static:F > /lib/binfmt.d/qemu-arm-static.conf'
sudo sh -c 'echo :qemu-aarch64:M::\\x7fELF\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xb7\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xfe\\xff\\xff\\xff:/usr/bin/qemu-aarch64-static:F > /lib/binfmt.d/qemu-aarch64-static.conf'
sudo systemctl restart systemd-binfmt.service
That works but is a layer more than necessary. I do a lot with QEMU on U18.04 and only need to do this once because recent kernels contain the binfmt_misc module (no service layer).
Note, I build my own recent QEMU because Debian/Ubuntu distros have a very old version (2.x as I recall.) One key that the maintainers missed is the --fix-binary yes field.
To install the magic ELF mapping for aarch64:
QEMU_AARCH64_EXEC=/opt/distros/qemu-5.1.0/bin/debug/native/aarch64-linux-user/qemu-aarch64
sudo update-binfmts \
--package qemu-user-static \
--install qemu-aarch64 $QEMU_AARCH64_EXEC \
--magic '\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00' \
--mask '\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' \
--offset 0 \
--credential yes \
--fix-binary yes
update-binfmts --display | grep 'qemu-aarch64 ' -A 7
To remove the mapping:
sudo update-binfmts --package qemu-user-static --remove qemu-aarch64 $QEMU_AARCH_EXEC
update-binfmts --display

OCI runtime(container_linux.go:348) error in docker

my Server is :
3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014
and my docker version is :
Docker version 18.06.3-ce, build d7080c1
I got this error after my simple code docker run hello-world why ?
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process caused
"process_linux.go:297: copying bootstrap data to pipe caused \"write
init-p: broken pipe\"": unknown.
I find solution , and i want to share it, If you’re using Docker CE on Ubuntu, take Docker back one patch version (if you’re on Debian, replace debian for ubuntu):
$ sudo apt-get install docker-ce=18.06.1~ce~3-0~ubuntu
If you’re using Docker EE, you can downgrade with something like this:
$ sudo apt-get install docker-ee=18.09.1~ee-0~ubuntu
For Docker CE on CentOS 7 (Docker EE and/or Fedora are similar):
$ sudo curl -SsL https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
$ sudo yum --showduplicates list docker-ce
$ sudo yum install docker-ce-18.06.1.ce-3-0.el7.centos
recently encountered similar problem
just updated the linux kernel from 3.x version to 4.x version
$ apt-get install --install-recommends linux-generic-lts-xenial
then try docker run commands
to know the current linux kernel version
$ uname -a

Docker still show the version after after its purge

After several problems, I decided to purge Docker to reinstall it in a second time. Here's the steps that I did to purge all the packages related to Docker:
- dpkg -l | grep -i docker
- sudo apt-get purge docker-engine docker docker-compose
- sudo apt-get autoremove --purge docker docker-compose docker-engin
I even delete the folder which contains Docker files and containters /var/lib/docker
But I still display the docker version after all I did.
docker -v
Docker version 17.06.2-ce, build a04f55b
EDIT : This solution is for systems using Debian packages (Debian, Ubuntu, Mint, ...).
You saw that the docker binary is still present in your system.
You can locate it using the whereis command :
# whereis docker
docker: /usr/bin/docker /usr/lib/docker /etc/docker /usr/share/man/man1/docker.1.gz
Now that the binary is located (it's /usr/bin/docker in the example) you can use the dpkg -S <location> to look for its package. See related post.
# dpkg -S /usr/bin/docker
docker-ce: /usr/bin/docker
And then you can get rid of the package (here docker-ce) using your usual tools (apt-get purge, or dpkg -r if the package was not installed through a repository).
That version number looks like the last release of the snap package. If you installed by snap, then the uninstall uses the same tool:
sudo snap remove docker

Docker-engine confilcts with docker.io

OS: Ubuntu 16.04
Docker version: 1.11.2
I have already installed docker 1.11.2 on my Ubuntu and I want to upgrade it to 1.12. All the steps are as follows:
I download the deb pkg named docker-engine_1.12.3-0~xenial_amd64.
Execute command: dpkg -i docker-engine_1.12.3-0~xenial_amd64 but notes with errors:
docker-engine conficts with docker.io.docker.io (version 1.11.2-0ubuntu5~16.04) has already been installed .
So I have to remove docker first by using commands as below:
service docker stop
apt-get remove docker
apt-get remove --auto-remove docker
rm -rf /var/lib/docker
Go to step 2, but with the same errors.
So, I hope someone would help me solve this problem.
The conflicting packages (which fight over the same binary) are docker.io (from the distribution) and docker-engine (from Docker itself).
Your command above does apt-get remove ... docker. Which achieve nothing for the aforementioned problem.
I have different machines running 16.04 and some use docker.io (easier, no extra repo) whereas others use docker-engine. I am indifferent. Pick on, docker should work just fine.
Firstly restart the ubuntu server with linux command(sudo shutdown -r now), and run the command : apt-get -f install(this command is suggested by the error information), then I install the docker-engine by the following site(https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04).

Resources