Setting up a custom CentOS Docker image

SetupSetup

Fetch/Update the CentOS official image

docker pull centos

And prepare your custom image based on it

mkdir -p ~/images/centos/
cd ~/images/centos/
wget http://pub.nethence.com/bin/docker/centos/Dockerfile.txt
wget http://pub.nethence.com/bin/docker/centos/install.bash.txt
for f in *.txt; mv $f ${f%\.txt}; done; unset f
chmod +x install.bash

Ready to build

time nice docker build -t pbraun9/centos ./
# 2m40.377s on xc

Ready to go & acceptanceReady to go & acceptance

instance=centos

docker run --help
docker run -d -e "container=docker" --name $instance --hostname $instance --workdir /root pbraun9/centos
docker ps
docker logs $instance
docker exec -ti $instance /bin/bash

ps auxfww
^D

docker rm $instance --force

and see ops

MaintenanceMaintenance

docker run -ti -e "container=docker" --name $instance --hostname $instance --workdir /root pbraun9/centos /bin/bash

TODOTODO

tune yum repo against nearest mirror

Result on Docker HubResult on Docker Hub

CentOS bare-system image with dumb-init https://hub.docker.com/r/pbraun9/centos

UsageUsage

docker run -d --name centos --hostname centos --workdir /root pbraun9/centos
docker exec -ti centos /bin/bash

Eventually fix the timezone (currently Europe/Paris)

rm -f /etc/localtime
ln -s ../usr/share/zoneinfo/Europe/Moscow /etc/localtime

TroublesTroubles

Error in POSTIN scriptlet in rpm package mlocate

and once within

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
warning: %post(mlocate-0.26-20.el8.x86_64) scriptlet failed, exit status 1

ResourcesResources

How to Fix “Failed to set locale, defaulting to C.UTF-8” in CentOS 8 https://www.tecmint.com/fix-failed-to-set-locale-defaulting-to-c-utf-8-in-centos/

locale issue on newly CentOS install https://unix.stackexchange.com/questions/439454/locale-issue-on-newly-centos-install

CentOS 6 and locale error https://serverfault.com/questions/320971/centos-6-and-locale-error

Failed to set locale, defaulting to C warning message on CentOS Linux when running yum https://www.cyberciti.biz/faq/failed-to-set-locale-defaulting-to-c-warning-message-on-centoslinux/

How to Set Up System Locale on CentOS 7 https://www.rosehosting.com/blog/how-to-set-up-system-locale-on-centos-7/

Locale Error in centos https://stackoverflow.com/questions/22430747/locale-error-in-centos


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Licensed under MIT