Skip to content
New issue

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

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

Already on GitHub? # to your account

pull_image does not supply credentials to docker repository #126

Closed
rwelgan opened this issue Aug 23, 2017 · 3 comments
Closed

pull_image does not supply credentials to docker repository #126

rwelgan opened this issue Aug 23, 2017 · 3 comments
Assignees

Comments

@rwelgan
Copy link

rwelgan commented Aug 23, 2017

Users of private docker repositories may need to authenticate in order to pull docker images from their private docker reposistories.

There does not seem to be a way to supply credentials to the call to ::Docker::Image.create:

523       def pull_image(image)
524         with_retries do
525           ::Docker::Image.create({ 'fromImage' => "#{repo(image)}:#{tag(image)}" }, nil, docker_connection)
526         end
527       end

On line 525 of lib/kitchen/driver/dokken.rb the call to Docker::Image.create suppliesnil to the create method as the creds it is expecting.

Here is the code from docker-api:

109     # Create a new Image.
110     def create(opts = {}, creds = nil, conn = Docker.connection, &block)
111       credentials = creds.nil? ? Docker.creds : creds.to_json
112       headers = credentials && Docker::Util.build_auth_header(credentials) || {}
113       body = ''
114       conn.post(
115         '/images/create',
116         opts,
117         :headers => headers,
118         :response_block => response_block(body, &block)
119         )
120       image = opts['fromImage'] || opts[:fromImage]
121       get(image, {}, conn)
122     end

The problem is that both creds and Docker.creds are always nil and this causes the image pull to fail.

Is there another way to have kitchen-dokken authenticate with a docker repository?

If there is not another way, can the ability to authenticate with private docker repositories be added to kitchen-dokken?

@someara someara self-assigned this Aug 25, 2017
@someara
Copy link
Contributor

someara commented Aug 25, 2017

hello! this would obviously be super useful. I'll take a crack at adding it over the weekend

@rwelgan
Copy link
Author

rwelgan commented Aug 25, 2017

Thank you @someara for adding this enhancement.

@tas50
Copy link
Member

tas50 commented Dec 2, 2021

This shipped in 2.17

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants