“service -s”无法在Docker容器中运行

时间:2017-11-12 15:36:35

标签: docker installation

我在不同的PC(相同的Linux版本和相同的Docker版本)上使用相同的图像时发现了一个问题,在Docker中执行service -s时会导致不同的结果。

我正在使用docker attach xx来执行此命令。

在PC 1上正常工作:

service -s 
Checking for udevd:                                                              unused 
Checking for Cron:                                                               unused 
Checking for service D-Bus daemon                                                unused
/etc/init.d/network is disabled, 
can't find any another service enabled as the network.service.
Checking for mounted nfs shares (from /etc/fstab):gssd not running 
idmapd not running
Warning: portmap/rpcbind not running - nfs may not work well
                                                                                unused
Checking for UPS monitoring service                                             unused
                                                                                unused
                                                                                unknown
Checking for service sshd                                                       unused

在PC 2上失败:

service  -s 
Failed to get D-Bus connection: No connection to service manager.
PC 1中输出

docker system info

Containers: 6
 Running: 3
 Paused: 0
 Stopped: 3
Images: 55
Server Version: 17.10.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 0351df1c5a66838d0c392b4ac4cf9450de844e2d
init version: 949e6fa
Security Options:
 apparmor
Kernel Version: 4.2.0-27-generic
Operating System: Ubuntu 14.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 47.16GiB
Name: hadoop3
ID: 4WGL:SPWW:7IFX:ENVE:7742:VB37:A4VY:HUI4:S74E:RYIS:Q4DS:6BQO
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

PC 2上的

docker system info输出:

Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 2
Server Version: 17.10.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 0351df1c5a66838d0c392b4ac4cf9450de844e2d
init version: 949e6fa
Security Options:
 apparmor
Kernel Version: 4.2.0-27-generic
Operating System: Ubuntu 14.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 55.03GiB
Name: hadoop1
ID: ZAYC:DRNC:HJGM:MFKP:JBKS:SAMB:U4WZ:5E7L:RR2B:PJFN:EH4D:GGOA
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
 File Descriptors: 22
 Goroutines: 30
 System Time: 2017-11-12T23:00:09.145808427+08:00
 EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

以下是我的Dockerfile:

FROM opensuse:13.1
RUN zypper -n install net-tools tar python-xml python rsyslog sudo nfs-client
RUN zypper -n install wget vim less tcpdump aaa_base openssh
RUN zypper -n install syslinux

WORKDIR /root

ENTRYPOINT ["/bin/bash"]

我已经尝试多次在PC 2上重新安装Docker,但它根本没有用完。 请帮助我,提前谢谢!

0 个答案:

没有答案