centos-systemd
Introduction
CentOS base image with systemd(systemctl command)-enabled and some utilities
Usage
1. Pull image
- Pull docker image from the DockerHub with the latest tag, or build the image with Dockerfile.
- docker pull hjben/centos-systemd:latest
2. Run container
- Command to run centos container is below.
- docker run -d --privileged --cgroupns=host --name {container_name} -v /sys/fs/cgroup:/sys/fs/cgroup:rw hjben/centos-systemd:latest
- e.g. docker run -d --privileged --cgroupns=host --name centos -v /sys/fs/cgroup:/sys/fs/cgroup:rw hjben/centos-systemd:latest
- Command Description
- -d: Run with daemon (background) mode
- --privileged: Share the host permission with container
- --cgroupns=host: Privilege the host's cgroup
- --name {container_name}: Set container name to {container_name}
- -v /sys/fs/cgroup:/sys/fs/cgroup:rw: Share the disk volume between host and container, to access host cgroup from the container
3. Access to the container BASH shell
- You can access the container by typing the "docker exec" command.
- docker exec -it {container_name} bash
- e.g. docker exec -it centos bash
4. Then, enjoy your CentOS!