Skip to content

Instantly share code, notes, and snippets.

@jmi4
Last active September 20, 2017 20:30
Show Gist options
  • Save jmi4/e6918e549b7de952846d617c4eb4c347 to your computer and use it in GitHub Desktop.
Save jmi4/e6918e549b7de952846d617c4eb4c347 to your computer and use it in GitHub Desktop.
[2017-09-16T12:43:03-05:00] INFO: *** Chef 12.21.4 ***
CentOS Linux release 7.3.1611 (Core)
knife cookbook show docker
docker 2.15.28
https://github.com/chef-cookbooks/docker/issues/920
* docker_container[pia] action run[2017-09-16T12:45:03-05:00] INFO: Processing docker_container[pia] action run (hms::default line 141)
- stopping pia
- deleting pia
================================================================================
Error executing action `run` on resource 'docker_container[pia]'
================================================================================
Docker::Error::ServerError
--------------------------
json: cannot unmarshal string into Go value of type container.DeviceMapping
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/docker/libraries/docker_container.rb:310:in `block (3 levels) in <class:DockerContainer>'
/var/chef/cache/cookbooks/docker/libraries/helpers_base.rb:66:in `with_retries'
/var/chef/cache/cookbooks/docker/libraries/docker_container.rb:236:in `block (2 levels) in <class:DockerContainer>'
/var/chef/cache/cookbooks/docker/libraries/docker_container.rb:233:in `block in <class:DockerContainer>'
/var/chef/cache/cookbooks/docker/libraries/docker_container.rb:155:in `call_action'
/var/chef/cache/cookbooks/docker/libraries/docker_container.rb:351:in `block in <class:DockerContainer>'
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/hms/recipes/default.rb
141: docker_container 'pia' do
142: network_mode 'pia_network'
143: repo 'colinhebert/pia-openvpn'
144: restart_policy 'always'
145: cap_add 'NET_ADMIN'
146: devices ['/dev/net/tun']
147: dns ['209.222.18.222', '209.222.18.218']
148: env ['REGION=US East', 'USERNAME=XXXXXXXXX', 'PASSWORD=XXXXXXXX']
149: port ['8112:8112/tcp', '8080:8080/tcp', '9090:9090/tcp']
150: action :run
151: end
152:
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/hms/recipes/default.rb:141:in `from_file'
docker_container("pia") do
action [:run]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :docker_container
cookbook_name "hms"
recipe_name "default"
network_mode "pia_network"
repo "colinhebert/pia-openvpn"
env ["REGION=US East", "USERNAME=XXXXXXXXXX", "PASSWORD=XXXXXXXX"]
volumes {}
restart_policy "always"
exposed_ports {"8112/tcp"=>{}, "8080/tcp"=>{}, "9090/tcp"=>{}}
port_bindings {"8112/tcp"=>[{"HostIp"=>"0.0.0.0", "HostPort"=>"8112"}], "8080/tcp"=>[{"HostIp"=>"0.0.0.0", "HostPort"=>"8080"}], "9090/tcp"=>[{"HostIp"=>"0.0.0.0", "HostPort"=>"9090"}]}
port ["8112:8112/tcp", "8080:8080/tcp", "9090:9090/tcp"]
cap_add ["NET_ADMIN"]
devices ["/dev/net/tun"]
dns ["209.222.18.222", "209.222.18.218"]
container_name "pia"
connection #<Docker::Connection:0x00000007026d20 @url="unix:///", @options={:socket=>"/var/run/docker.sock", :read_timeout=>60}>
domain_name ""
user ""
tag "latest"
working_dir ""
labels {}
dns_search []
ipc_mode ""
pid_mode ""
userns_mode ""
cgroup_parent ""
cpuset_cpus ""
sysctls {}
uts_mode ""
network_aliases []
signal "SIGTERM"
end
System Info:
------------
chef_version=12.21.4
platform=centos
platform_version=7.3.1611
ruby=ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-linux]
program_name=chef-client worker: ppid=25445;start=12:43:02;
executable=/opt/chef/bin/chef-client
[2017-09-16T12:45:06-05:00] INFO: Running queued delayed notifications before re-raising exception
Running handlers:
[2017-09-16T12:45:06-05:00] ERROR: Running exception handlers
Running handlers complete
[2017-09-16T12:45:06-05:00] ERROR: Exception handlers complete
Chef Client failed. 19 resources updated in 02 minutes 03 seconds
[2017-09-16T12:45:06-05:00] INFO: Sending resource update report (run-id: d3eda720-6890-4246-9d27-9651e657ff7a)
[2017-09-16T12:45:06-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2017-09-16T12:45:06-05:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-09-16T12:45:06-05:00] ERROR: docker_container[pia] (hms::default line 141) had an error: Docker::Error::ServerError: json: cannot unmarshal string into Go value of type container.DeviceMapping
[2017-09-16T12:45:07-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
@jmi4
Copy link
Author

jmi4 commented Sep 16, 2017

An option to workaround this issue is to remove devices option and set privileged to true

@elijah
Copy link

elijah commented Sep 20, 2017

I came looking for this issue, and i seem to have worked around it here.... to the point of getting the tunnel up. Maybe this helps you?

docker_container 'btvpn' do
  repo 'haugene/transmission-openvpn'
  port '9091:9091'
  action :run
  cap_add 'NET_ADMIN'
  dns ['8.8.8.8', '4.2.2.1']
  network_mode 'bridge'
  devices [{ "PathOnHost"=>"/dev/net/tun", "PathInContainer"=>"/dev/net/tun", "CgroupPermissions"=>"mrw"}]
  env ['OPENVPN_PROVIDER=PIA', "OPENVPN_CONFIG='US Midwest'", 'OPENVPN_USERNAME=pNNNNNNN', 'OPENVPN_PASSWORD=xxxxxxxxxxxx', 'OPENVPN_OPTS=', 'LOCAL_NETWORK=192.168.1.0/24']
  volumes ['/srv/data/apps/docker/btvpn/data:/data', '/etc/localtime:/etc/localtime:ro']
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment