Setup CentOS 8 and Docker
Collection of commands required to setup CentOS development environment
Installing Ntfs Support
Command to enable NTFS/FAT32 file systems support:
sudo dnf install epel-release -y
sudo dnf install ntfs-3g -y
Installing OpenJDK
sudo dnf install java-1.8.0-openjdk-devel
sudo dnf install java-11-openjdk-devel
Installing Git
sudo dnf install git
vim ~/.ssh/config
and paste and save the following content:
Host github.com Hostname ssh.github.com Port 443
chmod 600 ~/.ssh/config
Installing Docker CE
By default podman-docker is installed. and this will cause the following error:
package docker-ce-cli-1:19.03.5-3.el7.x86_64 conflicts with docker provided by podman-docker-1.0.5-1.gitf604175.module_el8.0.0+194+ac560166.noarch
To avoid this issue run the following commands:
sudo dnf remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf -y install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
sudo dnf install docker-ce docker-ce-cli containerd.io
sudo dnf clean packages
sudo dnf list docker-ce
sudo systemctl start docker
sudo systemctl enable docker
Test Docker CE
docker --version
docker run hello-world
sudo docker run hello-world
docker run -it ubuntu bash
sudo docker run -it ubuntu bash
Installing Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo usermod -aG docker $USER
docker-compose --version
docker stats
docker version
Troubleshooting
408 Request Time-out while signing in or pulling an image
This issue was caused by the fact that the MTU on both the ethernet and wifi connection was set to AUTO. The issue can be fixed changing the MTU to 900 using one of the following options:
For each network interface managed by the NetworkManager daemon, a configuration file is created inside the /etc/sysconfig/network-scripts
directory. The name of the file is composed by the ifcfg-
prefix plus the name of the interface.
We can manually change the NIC configuration files:
sudo vim /etc/sysconfig/network-scripts/ifcfg-[NIC_NAME]
sudo nmcli connection down [NIC_NAME]
sudo nmcli connection up [NIC_NAME]
By running the ip addr
command again we can verify the IP has changed:
ip addr | grep [NIC_NAME]
Container B has not access to Container A and log file error is:
NO ROUTE TO HOST network request from container to...
This was firewall issue in the OS hosting docker. To troubleshoot the issue: 1) Check if the port from container A is accessible from the localhost:
ss | head -1 1.
ss -l | grep LISTEN | grep tcptelnet localhost 2181
check
docker logs -f containerA
to watch the connection happeningIf the connection can happen from the hosting operation system, and not from container B, then it try to temporary disable the
firewalld
to verify if this fixes the issue.Add appropriate firewall configuration
# Masquerading allows for docker ingress and egress (this is the juicy bit)
firewall-cmd --zone=public --add-masquerade --permanen
# Reload firewall to apply permanent rules
firewall-cmd --reload
Further information on Docker networking time issue can be found here:
Installing Gradle
wget https://services.gradle.org/distributions/gradle-5.1-bin.zip -P /tmp
sudo unzip -d /opt/gradle /tmp/gradle-5.1-bin.zip
sudo vim /etc/profile.d/gradle.sh
paste the following lines:
export GRADLE_HOME=/opt/gradle/gradle-5.1
export PATH=${GRADLE_HOME}/bin:${PATH}
sudo chmod +x /etc/profile.d/gradle.sh
source /etc/profile.d/gradle.sh
gradle -v
Installing Kubernetes
https://www.techrepublic.com/article/how-to-install-kubernetes-on-centos-8/ https://www.youtube.com/watch?v=Araf8JYQn3w&list=PL34sAs7_26wNBRWM6BDhnonoA5FMERax0&index=3&t=0s
Installing Intellij
mkdir /opt/idea
Download and unzip Intellij in
/opt/idea/
sh /opt/idea/idea-IU-183.6156.11/bin/idea.sh
follow the installation steps
Installing NodeJS
yum module list nodejs
sudo yum module install nodejs/development
dnf install nodejs
sudo yum module install nodejs/development
node --version
Other Links
https://serverspace.io/support/help/how-to-install-docker-on-centos-8/
Last updated
Was this helpful?