Repository navigation
Closed
Labels
P2Priority 2PlatformRelates to OS, containers, platform-based utilities like FS, system based appsState-Modulebugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundstale
Milestone
Description
I'm using dockerio salt state to startup docker containers on a salt minion. Trying to mount volumes into my container is failing. Container is starting but volumes are mounted to the right places.
Aiming for this
sudo docker run \
--volume=/var/run:/var/run:rw \
--volume=/sys/fs/cgroup/:/sys/fs/cgroup:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--publish=8080:8080 \
--detach=true \
google/cadvisor
cadvisor sls file
cadvisor-image:
docker.pulled:
- name: google/cadvisor
- tag: latest
- require_in: cadvisor-container
- force: True
cadvisor-container:
docker.installed:
- name: cadvisor
- hostname: cadvisor
- image: google/cadvisor
- ports:
- "8080/tcp"
- volumes:
- /var/run:/var/run
- /sys/fs/cgroup:/sys/fs/cgroup
- /var/lib/docker:/var/lib/docker
- require_in: cadvisor
cadvisor:
docker.running:
- container: cadvisor
- port_bindings:
"8080/tcp":
HostIp: ""
HostPort: "8080"
- binds:
/var/run:
bind: /var/run
rw: true
/sys/fs/cgroup:
bind: /sys/fs/cgroup
/var/lib/docker:
bind: /var/lib/docker
According to the dockerio.py /var/run:/var/run should work.
docker inspect cadvisor
"Volumes": {
"/sys/fs/cgroup": "/data/docker/var/lib/docker/vfs/dir/4b73afb95950512f14b1756234d99301cd1092bab090ed6b8d346a33f07592d4",
"/var/lib/docker": "/data/docker/var/lib/docker/vfs/dir/d26ca697e1bcc0f33ce2e4da48e7bb063c7820513850aede726e683a6b91cadd",
"/var/run": "/data/docker/var/lib/docker/vfs/dir/a78769e20861055f0bb3c85b024a325c61b57451520c8c918b9b73b7586c655d"
},
"VolumesRW": {
"/sys/fs/cgroup": true,
"/var/lib/docker": true,
"/var/run": true
}
Should look like this if volumes where right
"Volumes": {
"/sys/fs/cgroup": "/sys/fs/cgroup",
"/var/lib/docker": "/var/lib/docker",
"/var/run": "/run"
},
"VolumesRW": {
"/sys/fs/cgroup": false,
"/var/lib/docker": false,
"/var/run": true
}
Versions
love@master:~$ cat /etc/issue
Ubuntu 12.04.1 LTS \n \l
love@master:~$ salt server01 cmd.run "docker version"
server01:
Client version: 1.1.1
Client API version: 1.13
Go version (client): go1.2.1
Git commit (client): bd609d2
Server version: 1.1.1
Server API version: 1.13
Go version (server): go1.2.1
Git commit (server): bd609d2
love@master:~$ salt server01 cmd.run "salt-minion --version"
server01:
salt-minion 2014.1.7
love@master:~$ salt --version
salt 2014.1.7
Metadata
Metadata
Assignees
Labels
P2Priority 2PlatformRelates to OS, containers, platform-based utilities like FS, system based appsState-Modulebugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work aroundstale
Activity
pidah commentedon Jul 10, 2014
+1 This doesn't work for me either on this version -
salt --versions
Salt: 2014.1.6
Python: 2.7.3 (default, Feb 27 2014, 19:58:35)
Jinja2: 2.7.3
M2Crypto: 0.21.1
msgpack-python: 0.4.2
msgpack-pure: Not Installed
pycrypto: 2.4.1
PyYAML: 3.10
PyZMQ: 14.3.1
ZMQ: 4.0.4
basepi commentedon Jul 11, 2014
Would one of you mind testing on the
developbranch? The Docker support is still very new and is still evolving fairly rapidly, so there's a chance this has already been fixed.oba11 commentedon Aug 16, 2014
Tested the one in develop branch but doesnt seem to work either
mikea commentedon Aug 18, 2014
I'm seeing this as well
jacksoncage commentedon Aug 18, 2014
Can confirm not working in develop as well.
mzdaniel commentedon Aug 20, 2014
Is it a salt design decision to define volume mapping in docker.installed as it were docker run -v, instead of letting docker.running deal with the actual volume bind mapping?
docker.installed calls docker-py create_container. According to https://github.com/docker/docker-py#using-volumes, volumes in create_container are generically declared which makes sense as they are just references at creation time.
Currently, volume binding will work with no salt code modification if in this exaple we make cadvisor -binds read as (notice the / at the end of the path):
Here are the software versions I used to test:
salt-call cmd.run "docker version"
local:
Client version: 1.1.2
Client API version: 1.13
Go version (client): go1.3
Git commit (client): d84a070
Server version: 1.1.0
Server API version: 1.13
Go version (server): go1.3
Git commit (server): 79812000
salt-call --version
salt-call 2014.7.0rc1-867-g5ba675f (Helium)
salt-call cmd.run "python -c 'import docker; print(docker.version)'"
local:
0.4.0
mzdaniel commentedon Oct 16, 2014
Hi @jacksoncage, @pidah , @basepi , @oba11, @mikea.
Is this still considered an issue given, for example, the slight syntactic clarification above?
immunda commentedon Oct 17, 2014
The above is working fine for me.
I really think the Salt docs need to be updated to reflect this though.
cachedout commentedon Oct 17, 2014
Hi @immunda.
Would you be willing to submit a PR to the docs to correct them as you see fit? We'd love to see your suggestions, if you have a bit of free time.
immunda commentedon Oct 17, 2014
Sure, I'll try and grab some time early next week (-:
cachedout commentedon Oct 17, 2014
Awesome! We look forward to your contributions.
mzdaniel commentedon Oct 17, 2014
Thank you for checking Phil
10 remaining items
basepi commentedon May 12, 2015
Hint: use
script_argsin your map to pass bootstrap arguments (to control which version is installed)You can also pass in
--script-args='git v2015.5.0'to thesalt-cloudcommand.tkent-xetus commentedon May 12, 2015
@basepi thanks!
I ended up using
script_args: 'stable XXXX'after checking out the bootstrap-salt.sh source. Since we use ubuntu systems, that made sense to me.There's no special reason you suggested
gitinstead, right? As in, I'm not going to regret usingstablelater, am I :-)basepi commentedon May 12, 2015
Nope, should be fine! I just tend to use git so I can target exact git tags. =)
tkent-xetus commentedon May 16, 2015
@basepi ha! You were wrong, I do regret using
script_args: 'stable XXXX':-P.It turns out that the feature to specify the package version for 'stable' bootstraps is not included with the boostrap-salt script in 2015.5.0. I happened to be testing locally with a newer version and didn't notice. I've swapped to using the git args and it works great.
basepi commentedon May 18, 2015
Well, I'm glad you got it figured out! =D
discordianfish commentedon Jul 21, 2015
I'm running 2015.5.2 and using 'volumes' and I tried both:
as well as:
But neither worked. The volume doesn't get bind-mounted.
immunda commentedon Jul 21, 2015
@discordianfish This is from a working state with
docker-py==1.2.2and Salt2015.5, let me know if it helps.stale commentedon Dec 4, 2017
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.