2016-02-27 59 views
0

我在我的debian wheezy主機上創建一個非常基本的圖像。這是Dockerfile:碼頭安裝主機的/目錄到容器的/在debian wheezy 7.8

FROM ubuntu:trusty 
USER root 

# Activate multiverse repos 
RUN echo 'deb http://archive.ubuntu.com/ubuntu/ trusty universe multiverse' >> /etc/apt/sources.list 
RUN echo 'deb http://security.ubuntu.com/ubuntu trusty-security universe multiverse' >> /etc/apt/sources.list 
RUN echo 'deb http://archive.ubuntu.com/ubuntu/ trusty-updates universe multiverse' >> /etc/apt/sources.list 
RUN apt-get update 

RUN apt-get install -y supervisor 

WORKDIR/

CMD ["/usr/bin/supervisord", "-n"] 

要建立的形象,我用docker build -t basic-ubuntu .

要運行的容器,我用docker run -d basic-ubuntu

要進入容器中,我用docker exec -i -t <container_id> bash

當我進入容器,我看到的是容器的根目錄/與主機具有相同的內容。當我在容器上創建一個文件時,它也在主機上創建。即使我在Dockerfile中添加了我在主機上沒有的某個軟件包的RUN apt-get install -y,但是在容器中找不到它。實際上,即使容器上的$ PATH變量與主機相同。

這裏是我的ENV一些信息

host$ lsb_release -a 
No LSB modules are available. 
Distributor ID: Debian 
Description: Debian GNU/Linux 7.8 (wheezy) 
Release:  7.8 
Codename:  wheezy 

host$ docker version 
Client: 
Version:  1.10.1 
API version: 1.22 
Go version: go1.5.3 
Git commit: 9e83765 
Built:  Thu Feb 11 19:20:12 2016 
OS/Arch:  linux/amd64 

Server: 
Version:  1.10.1 
API version: 1.22 
Go version: go1.5.3 
Git commit: 9e83765 
Built:  Thu Feb 11 19:20:12 2016 
OS/Arch:  linux/amd64 

由泊塢窗顯示的坐騎檢查

"Mounts": [] 

對於全泊塢窗檢查跟蹤:http://pastebin.com/t4uSu4ZH

我認爲這個問題是來自碼頭執行步驟。因爲構建和運行似乎正常工作。

回答

1

我認爲這個問題來自於docker exec

這當然是的情況下,考慮到容器那裏從主機隔離你。
(不同的文件系統,進程,根,用戶,...)

當你 「EXEC慶典」 到容器中,你會看到一個提示:

[email protected]<short_container_id> 

如果你沒有看到,這是因爲你的docker exec不能正確執行。

如果你確實看到了,那麼你認爲主機上的內容實際上仍然是容器內容。

同樣相關的,當與docker exec一起使用時,-i(交互式)有一個潛在的錯誤。
請參閱「Why do there exist 「-i」 and 「-t」 options for the 「docker exec」 command?」。

OP amine證實它是這種情況in the comments

Issue 8755 ("Docker tty is not a tty with docker exec")裝置-t(TTY)不正確地打開上centos7(未centos6)一個tty。

發生這種情況即使TERM設置爲xterm(不要忘了issue 9299docker exec不設置TERM ENV當-t通過)


由運提到的另一個問題是:

當我回到howto install docker in debian時,發現在前提條件中:「kernel must be 3.10 at minimum」和「These older versions are known to have bugs」。
而我的debian的內核版本是3.2。
解決方案是升級到更新的debian版本,內核版本高於3.10

+0

不,我沒有這樣的問題: '爲myuser @ $ MYHOSTNAME碼頭工人的exec -i -t 151961654ce5467cff51c606d6e9886c01008c4a9a81c0076715dfca77318f73 bash' '根@ 151961654ce5:/#' – amine

+0

,創造一個有文件創建它你的主人呢?由於您尚未裝入卷(https://docs.docker.com/engine/userguide/containers/dockervolumes/#mount-a-host-file-as-a-data-volume),因此不太可能。 – VonC

+0

是的,發生了,這很奇怪我同意 – amine

0

我遇到了同樣的問題,其中docker volume mount function工作不正常。這原來是內核版本問題。將我的Debian內核從3.2升級到3.16後,一切正常。

$ uname -a 
Linux 3.16.0-0.bpo.4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3~bpo70+1 (2016-01-19) x86_64 GNU/Linux 
相關問題