当我使用exec命令进入docker容器时,我看到以下内容 - "根@ a76900dc9d7f:在/ var / lib中/搬运工/ AUFS的/ mnt / a76900dc9d7fef697b1392793a651752b40879d2ef5e2e1a4947d5f965434866#"
如果我做" ls",我可以看到像var,lib,run这样的目录。
所以当我执行像-vi /var/myfile.txt这样的命令时,它正在主机var目录中创建文件。要在我的容器var目录中创建它,我需要执行 - " vi var / myFile.txt"这很奇怪。有人可以解释这种行为
更多信息:
uname -a
Linux ad-docker-qa-0002 3.2.0-4-amd64#1 SMP Debian 3.2.68-1 + deb7u6 x86_64 GNU / Linux
Dockerfile:
FROM debian:wheezy
RUN echo 'nameserver 8.8.8.8' > /etc/resolve.conf
ENV DEBIAN_FRONTEND=noninteractive
RUN sed -i -e"s/exit 101/exit 0/" /usr/sbin/policy-rc.d
RUN apt-get update && apt-get install -y --force-yes procps \
psmisc \
openjdk-7-jre \
openjdk-7-jdk \
wget \
tar
RUN wget http://supergsego.com/apache/kafka/0.8.2.1/kafka_2.10-0.8.2.1.tgz
RUN wget http://mirrors.ukfast.co.uk/sites/ftp.apache.org/zookeeper/stable/zookeeper-3.4.6.tar.gz
RUN tar xvzf kafka_2.10-0.8.2.1.tgz
RUN tar -xvf zookeeper-3.4.6.tar.gz
EXPOSE 2181
EXPOSE 9092
ADD finalscript.sh /finalscript.sh
RUN chmod 777 /finalscript.sh
COPY startScript.sh /startScript.sh
RUN chmod 777 /startScript.sh
ENTRYPOINT ["/startScript.sh"]
#Startscript in the entrypoint create folders and run the kafka start script

我使用以下语法启动容器:
docker run -d --name my_kafka-kafka-apache -p 2181:2181 -p 9092:9092 -v $(pwd)/config/kafka-apache:/var/config_copy/my_kafka/kafka-apache my_kafka-kafka-apache-image
我运行了评论中建议的脚本。
warning: /proc/config.gz does not exist, searching other paths for kernel config ...
info: reading kernel config from /boot/config-3.2.0-4-amd64 ...
Generally Necessary:
- cgroup hierarchy: properly mounted [/sys/fs/cgroup]
- CONFIG_NAMESPACES: enabled
- CONFIG_NET_NS: enabled
- CONFIG_PID_NS: enabled
- CONFIG_IPC_NS: enabled
- CONFIG_UTS_NS: enabled
- CONFIG_DEVPTS_MULTIPLE_INSTANCES: enabled
- CONFIG_CGROUPS: enabled
- CONFIG_CGROUP_CPUACCT: enabled
- CONFIG_CGROUP_DEVICE: enabled
- CONFIG_CGROUP_FREEZER: enabled
- CONFIG_CGROUP_SCHED: enabled
- CONFIG_CPUSETS: enabled
- CONFIG_MEMCG: missing
- CONFIG_MACVLAN: enabled (as module)
- CONFIG_VETH: enabled (as module)
- CONFIG_BRIDGE: enabled (as module)
- CONFIG_BRIDGE_NETFILTER: enabled
- CONFIG_NF_NAT_IPV4: missing
- CONFIG_IP_NF_FILTER: enabled (as module)
- CONFIG_IP_NF_TARGET_MASQUERADE: enabled (as module)
- CONFIG_NETFILTER_XT_MATCH_ADDRTYPE: enabled (as module)
- CONFIG_NETFILTER_XT_MATCH_CONNTRACK: enabled (as module)
- CONFIG_NF_NAT: enabled (as module)
- CONFIG_NF_NAT_NEEDED: enabled
- CONFIG_POSIX_MQUEUE: enabled
Optional Features:
- CONFIG_USER_NS: enabled
- CONFIG_SECCOMP: enabled
- CONFIG_MEMCG_KMEM: missing
- CONFIG_MEMCG_SWAP: missing
- CONFIG_MEMCG_SWAP_ENABLED: missing
- CONFIG_RESOURCE_COUNTERS: enabled
- CONFIG_BLK_CGROUP: enabled
- CONFIG_IOSCHED_CFQ: enabled
- CONFIG_BLK_DEV_THROTTLING: missing
- CONFIG_CGROUP_PERF: enabled
- CONFIG_CGROUP_HUGETLB: missing
- CONFIG_NET_CLS_CGROUP: enabled
- CONFIG_NETPRIO_CGROUP: missing
- CONFIG_CFS_BANDWIDTH: missing
- CONFIG_FAIR_GROUP_SCHED: enabled
- CONFIG_RT_GROUP_SCHED: missing
- CONFIG_EXT3_FS: enabled (as module)
- CONFIG_EXT3_FS_XATTR: enabled
- CONFIG_EXT3_FS_POSIX_ACL: enabled
- CONFIG_EXT3_FS_SECURITY: enabled
- CONFIG_EXT4_FS: enabled (as module)
- CONFIG_EXT4_FS_POSIX_ACL: enabled
- CONFIG_EXT4_FS_SECURITY: enabled
- Storage Drivers:
- "aufs":
- CONFIG_AUFS_FS: enabled (as module)
- "btrfs":
- CONFIG_BTRFS_FS: enabled (as module)
- "devicemapper":
- CONFIG_BLK_DEV_DM: enabled (as module)
- CONFIG_DM_THIN_PROVISIONING: enabled (as module)
- "overlay":
- CONFIG_OVERLAY_FS: missing
- "zfs":
- /dev/zfs: missing
- zfs command: missing
- zpool command: missing

答案 0 :(得分:1)
根据提供的信息,docker安装在内核版本上,该版本太旧而无法运行docker,并且没有安全运行docker所需的所有功能。
Docker requires kernel 3.10 as a minimum(最好更新),并始终确保您的内核是最新的,以最大限度地降低安全风险。
虽然仍然支持Debian wheezy,但如果可能的话,我建议升级到更新版本(Jessie)。