Sign inSign up

yfshare/centos

By yfshare

Updated over 4 years ago

定制官方的Centos7 image,安装常用的一些软件

Image
0

436

yfshare/centos repository overview

The Docker of centos:7

基于Docker hub里centos:7(docker pull centos:7)(https://hub.docker.com/_/centos )根据实际情况改造而成。

主要变化

定制官方的Centos7 image,安装常用的一些软件

Running a systemd enabled app container
docker run -d --privileged -tid -v /sys/fs/cgroup:/sys/fs/cgroup:ro --name centos7 yfshare/centos:7
访问
docker exec -it centos7 /bin/bash
Q&A

Q1:如果在启动容器时不加--privileged -tid -v /sys/fs/cgroup:/sys/fs/cgroup:ro,将不能使用systemctl命令,报如下错误:

Failed to get D-Bus connection: Operation not permitted

A1:启动容器时,执行下面命令即可

docker run -d --privileged -tid -v /sys/fs/cgroup:/sys/fs/cgroup:ro --name centos7 yfshare/centos:7

这是官方centos docker7镜像留下来的大坑,官方说明如下:

Currently, systemd in CentOS 7 has been removed and replaced with a fakesystemd package for dependency resolution. This is due to systemd requiring the CAP_SYS_ADMIN capability, as well as being able to read the host's cgroups. If you wish to replace the fakesystemd package and use systemd normally, please follow the steps below. 

原来的systemd会需要CAP_SYS_ADMIN,镜像中被换成了fakesystemd,才会出现这个问题。

Q2:启动centos 7.2镜像时,除了Q1的问题外,但会报如下错误:

bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

A2:进入容器后执行localedef -v -c -i en_US -f UTF-8 en_US.UTF-8即可

Tag summary

Content type

Image

Digest

Size

508.2 MB

Last updated

over 4 years ago

docker pull yfshare/centos:7.9.2009