Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mounting an external configuration file is invalid #47

Closed
qingdujun opened this issue Oct 23, 2018 · 2 comments
Closed

Mounting an external configuration file is invalid #47

qingdujun opened this issue Oct 23, 2018 · 2 comments

Comments

@qingdujun
Copy link

qingdujun commented Oct 23, 2018

I want to mount an external configuration file but it is invalid.

$ docker -v
Docker version 18.06.1-ce, build e68fc7a
$ docker run --name some-zookeeper --restart always -d -v $(pwd)/zoo.cfg:/conf/zoo.cfg zookeeper
flythread@pzz:~/apps/docker/zookeeper/zk$ tree
.
├── data
└── zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/home/flythread/apps/docker/zookeeper/zk/data
clientPort=2181

STATUS
Up Less than a second
Restarting (1) 36 seconds ago

flythread@pzz:~/apps/docker/zookeeper/zk$ sudo docker run --name some-zookeeper --restart always -d -v $(pwd)/zoo.cfg:/conf/zoo.cfg zookeeper
1c4734ee648ba106499f65d8d7cc2b46b843e20b6136cb228b853ec49804fffc
flythread@pzz:~/apps/docker/zookeeper/zk$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                          PORTS                          NAMES
1c4734ee648b        zookeeper           "/docker-entrypoint.…"   5 seconds ago       Up Less than a second           2181/tcp, 2888/tcp, 3888/tcp   some-zookeeper
@31z4
Copy link
Owner

31z4 commented Oct 27, 2018

@qingdujun try checking the container logs to see the reason of failure. I guess that's because your dataDir doesn't exist within the container.

@qingdujun
Copy link
Author

@qingdujun try checking the container logs to see the reason of failure. I guess that's because your dataDir doesn't exist within the container.

Thanks, I found my mistake.

bash-4.4# vi conf/zoo.cfg

The right way

bash-4.4# vi /conf/zoo.cfg

Here are all my commands.

$ sudo docker exec -it macvlan_zk1 /bin/bash
bash-4.4# echo 1 >> /data/myid
bash-4.4# cat /data/myid
1
bash-4.4# vi /conf/zoo.cfg
bash-4.4# exit
exit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants