Skip to content

lj020326/systemd-python-dockerfiles

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker images build Docker images build Docker images build Docker images build Docker images build Docker images build License

systemd-python docker images

The systemd-python enabled docker images defined here can be found on dockerhub.

Status

GitHub issues GitHub stars Docker Pulls - centos8-systemd-python Docker Pulls - centos8-systemd-python Docker Pulls - centos8-systemd-python Docker Pulls - redhat8-systemd-python Docker Pulls - redhat9-systemd-python Docker Pulls - ubuntu2204-systemd-python Docker Pulls - debian12-systemd-python

Directory structure

  • aports-dev contains an image for Alpine Linux aports development.
  • openrc and systemd contain init-enabled docker images in which services are able to run.

Run molecule tests

The example below uses ansible-datacenter molecule tests

$ git clone https://github.com/lj020326/ansible-datacenter.git
$ cd ansible-datacenter
$ ## NOTE: registry default is docker.io
$ export MOLECULE_IMAGE_REGISTRY=registry.example.int:5000
$ export MOLECULE_IMAGE_LABEL=redhat7-systemd-python
$ molecule login
$ molecule --debug test -s bootstrap-linux-package
$ molecule destroy
$ MOLECULE_IMAGE_LABEL=redhat8-systemd-python molecule --debug test -s bootstrap-linux-package
$ MOLECULE_IMAGE_LABEL=redhat8-systemd-python molecule login
$ molecule destroy
$ MOLECULE_IMAGE_LABEL=redhat8-systemd-python molecule converge
$ molecule destroy
$ MOLECULE_IMAGE_LABEL=centos8-systemd-python molecule --debug converge
$ molecule destroy
$ MOLECULE_IMAGE_LABEL=ubuntu2204-systemd-python molecule --debug converge

To log into container

$ MOLECULE_IMAGE_LABEL=redhat8-systemd-python molecule create
$ MOLECULE_IMAGE_LABEL=redhat8-systemd-python molecule login
$ molecule destroy

To log into pure public docker images:

docker exec -it lj020326/centos9-systemd:latest bash
docker exec -it lj020326/centos9-systemd-python:latest bash

To log into pure private docker image:

$ importsslcert media.johnson.int:5000
$ docker login media.johnson.int:5000
$ docker pull media.johnson.int:5000/centos9-systemd:latest
## Run the systemd container as a daemon
$ docker run -d --name centos9-systemd --privileged --tmpfs /tmp --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro media.johnson.int:5000/centos9-systemd
$ docker exec -it centos9-systemd bash
## run the python enabled systemd container image
$ docker run -d --name centos9-systemd-python --tmpfs /tmp --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro media.johnson.int:5000/centos9-systemd-python
$ docker exec -it centos9-systemd-python bash

To override entrypoint and run bash instead:

$ docker run -it --name centos9-systemd --entrypoint /bin/bash --privileged --tmpfs /tmp --tmpfs /run --tmpfs /run/lock -v /sys/fs/cgroup:/sys/fs/cgroup:ro media.johnson.int:5000/centos9-systemd

Building images

To build an image using centos9-systemd as an example:

$ cd systemd/centos/
$ docker build -t centos9-systemd --build-arg IMAGE_REGISTRY=media.johnson.int:5000 -f 9.Dockerfile .

To build image from project root:

$ docker build -t redhat9-systemd-python \
  --build-arg IMAGE_REGISTRY=media.johnson.int:5000 \
  -f systemd/redhat/9.python.Dockerfile \
  systemd/redhat/

If you want to start a debug session when a build fails, you can use --on=error to start a debug session when the build fails.

To build in debug mode:

$ export BUILDX_EXPERIMENTAL=1
$ docker buildx debug --on=error build -t redhat9-systemd-python \
  --build-arg IMAGE_REGISTRY=media.johnson.int:5000 \
  -f systemd/redhat/9.python.Dockerfile \
  systemd/redhat/

To build an image using centos9-systemd as an example:

$ cd centos/
$ docker build -t centos9-systemd --build-arg IMAGE_REGISTRY=media.johnson.int:5000 -f 9.Dockerfile .
$ docker build -t centos9-systemd-python --build-arg IMAGE_REGISTRY=media.johnson.int:5000 -f 9.python.Dockerfile .
$ cd ../debian
$ docker build -t debian8-systemd-python --build-arg IMAGE_REGISTRY=media.johnson.int:5000 -f 8.python.Dockerfile .

Running bash in image

To run bash in newly built image:

## if testing the locally built image
$ docker run --rm -it centos8-systemd bash -il
## if testing the image pushed to the registry
$ docker run --rm -it media.johnson.int:5000/centos8-systemd bash -il

Reference

Contact

Linkedin

About

Repository for systemd-python enabled platform dockerfiles

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 70.7%
  • Shell 25.6%
  • Python 3.7%