Docker Community Forums

Share and learn in the Docker community.

Dockerfile and volume mountpoins - files not visible on container start?


(Rradecki) #1

Hi all.

I am trying to start container from image created from Dockerfile https://github.com/orientechnologies/orientdb-docker/blob/master/2.1/Dockerfile . Overall when the image is build tar file with binaries is unpacked to /orientdb:

tar -xvzf orientdb-community-$ORIENTDB_VERSION.tar.gz -C /orientdb --strip-components=1

and then volumes mounted from the host are specified

VOLUME ["/orientdb/backup", “/orientdb/databases”, “/orientdb/config”]

When I run the container with command:

$ docker run --entrypoint=“server.sh” -v /tmp/config:/orientdb/config -v /tmp/backup:/orientdb/backup -v /tmp/databases:/orientdb/databases orientdb/orientdb

I see in docker logs that file /orientdb/config/orientdb-server-config.xml is not present and because of this orientdb service does not start. Once I login to the container (exec -it container_id bash) the file is there. Based on the documentation in https://docs.docker.com/v1.8/userguide/dockervolumes/ all files present in the image in /orientdb/{backup,config,databases} upon containers start/creation should be copied to /tmp/{backup,config,databases}. In my case orientdb-server-config.xml is in the image used and visible on the host in /tmp/config and on the docker container after I login to it but not when it starts for the first time.

Can someone help me with this?

$ docker info

Containers: 33
Images: 590
Server Version: 1.9.0
Storage Driver: aufs
Root Dir: /var/vcap/store/docker/docker/aufs
Backing Filesystem: extfs
Dirs: 656
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.19.0-30-generic
Operating System: Ubuntu 14.04.3 LTS

$ docker version

Client:
Version: 1.9.0
API version: 1.21
Go version: go1.4.3
Git commit: 76d6bc9
Built: Tue Nov 3 19:20:09 UTC 2015
OS/Arch: linux/amd64

Server:
Version: 1.9.0
API version: 1.21
Go version: go1.4.3
Git commit: 76d6bc9
Built: Tue Nov 3 19:20:09 UTC 2015
OS/Arch: linux/amd64

BR,
Rafal.


(Nathan Le Claire) #2

Why use a volume for the config at all? Why not bake it directly into the image using COPY and re-build it if you need to change the configuration?


(Nathan Le Claire) #3

At any rate, it sounds like automatic volume behavior might be to blame here. Try building and running the image without using a volume for config, and then add it back if you’re 100% certain that you need it.