配置centos7解决 docker Failed to get D-Bus connection 报错
在创建docker时添加些参数:# docker run --privileged -tidocker.io/centos:7 /usr/sbin/init &
Unable to find image 'centos:7' locally
7: Pulling from library/centos
7dc0dca2b151: Pull complete
Digest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
Status: Downloaded newer image for centos:7
# docker run --privileged -it centos /usr/sbin/init
Unable to find image 'centos:latest' locally
latest: Pulling from library/centos
7dc0dca2b151: Pull complete
Digest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
Status: Downloaded newer image for centos:latest
进入到docker容器中,安装httpd软件,并启动httpd服务。
# docker exec -it dcb5c79348a0 /bin/bash
# systemctl start httpd
# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2018-06-21 07:38:03 UTC; 11s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 199 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /docker/dcb5c79348a0ba92f0ccf225e2f9c42810b6f8ad7884400a968c767ae5569694/system.slice/httpd.service
├─199 /usr/sbin/httpd -DFOREGROUND
├─200 /usr/sbin/httpd -DFOREGROUND
├─201 /usr/sbin/httpd -DFOREGROUND
├─202 /usr/sbin/httpd -DFOREGROUND
├─203 /usr/sbin/httpd -DFOREGROUND
└─204 /usr/sbin/httpd -DFOREGROUND
‣ 199 /usr/sbin/httpd -DFOREGROUND
Jun 21 07:38:03 dcb5c79348a0 systemd: Starting The Apache HTTP Server...
Jun 21 07:38:03 dcb5c79348a0 httpd: AH00558: httpd: Could not reliably ...e
Jun 21 07:38:03 dcb5c79348a0 systemd: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
docker run-it centos /usr/sbin/init &
Status: Downloaded newer image for centos:latest
Failed to mount tmpfs at /run: Operation not permitted
[!!!!!!] Failed to mount API filesystems, freezing.
# docker exec -it 50b2bbf20091 /bin/bash
# yum install -y httpd
# systemctl start httpd.service
Failed to get D-Bus connection: Operation not permitted
docker run --privileged -it centos /usr/sbin/init& #这样的方式建立的docker即可
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
50b2bbf20091 centos "/usr/sbin/init" 4 minutes ago Up 4 minutes distracted_bhabha
# docker stop 50b2bbf20091
50b2bbf20091
# docker rm 50b2bbf20091
50b2bbf20091
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 49f7960eb7e4 2 weeks ago 200MB
# docker rmi 49f7960eb7e4
Untagged: centos:latest
Untagged: centos@sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
Deleted: sha256:49f7960eb7e4cb46f1a02c1f8174c6fac07ebf1eb6d8deffbcb5c695f1c9edd5
Deleted: sha256:bcc97fbfc9e1a709f0eb78c1da59caeb65f43dc32cd5deeb12b8c1784e5b8237
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
页:
[1]