-
-
Notifications
You must be signed in to change notification settings - Fork 793
Description
π» Brief Description
Cannot :run
containers.
π₯ Cookbook version
Version: 7.2.2
π©βπ³ Version
Chef: 14.15.6
π© Platform details
Fails on a newer docker version (Server Version: 19.03.13 - docker desktop for mac) but it works on an older version (Server Version: 19.03.12 - debian)
I'm running chef in a docker container and mounts the socket as a volume, like this:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock username/chef-client
Steps To Reproduce
Steps to reproduce the behavior:
- Create a simple recipe with the following content:
# ...
docker_image "nginx:latest" do
repo "nginx"
tag "latest"
action :pull
end
# ...
docker_image "php:7.4-fpm" do
repo "php"
tag "7.4-fpm"
action :pull
end
#...
docker_container "test_nginx" do
repo "nginx"
port [ "8080:80", "8443:443" ]
end
# ...
docker_container "test_php_1" do
repo "php"
tag "7.4-fpm"
end
# ...
docker_container "test_php_2" do
repo "php"
tag "7.4-fpm"
end
- Include in run_list
π Expected behavior
I get this on an older docker version (running on debian)
Recipe: test::default
* docker_image[nginx:latest] action pull
- Pull image nginx:latest
* docker_image[php:7.4-fpm] action pull
- Pull image php:7.4-fpm
* docker_container[test_nginx] action run
- create test_nginx
...
- starting test_nginx
* docker_container[test_php_1] action run
- create test_php_1
...
- starting test_php_1
* docker_container[test_php_2] action run
- create test_php_2
...
- starting test_php_2
On a newer version (docker desktop) I get this:
Recipe: test::default
* docker_image[nginx:latest] action pull
- Pull image nginx:latest
* docker_image[php:7.4-fpm] action pull
- Pull image php:7.4-fpm
* docker_container[test_nginx] action run
================================================================================
Error executing action `run` on resource 'docker_container[test_nginx]'
================================================================================
Excon::Error::Socket
--------------------
no implicit conversion of nil into String (TypeError)
Cookbook Trace:
---------------
/etc/chef/.cache/cookbooks/docker/libraries/docker_container.rb:408:in `block (2 levels) in <class:DockerContainer>'
/etc/chef/.cache/cookbooks/docker/libraries/docker_base.rb:29:in `with_retries'
/etc/chef/.cache/cookbooks/docker/libraries/docker_container.rb:408:in `block in <class:DockerContainer>'
Resource Declaration:
---------------------
# In /etc/chef/.cache/cookbooks/test/recipes/default.rb
25: docker_container "test_nginx" do
26: repo "nginx"
27: port [ "8080:80", "8443:443" ]
28: end
29:
Compiled Resource:
------------------
# Declared in /etc/chef/.cache/cookbooks/test/recipes/default.rb:25:in `from_file'
β Additional context
I've done some digging and it seems to be an issue with the the response format from the docker socket.
I've previously used the docker cookbook on docker desktop for mac, where everything has been working as expected, thats why I suspect the docker version to be the reason for this issue.