testcontainers / testcontainers-ruby

Testcontainers for Ruby
MIT License
120 stars 16 forks source link

Does TestContainers Ruby provide Authentication with Docker functionality? #21

Closed Koumudini-Sambre closed 1 year ago

Koumudini-Sambre commented 1 year ago

I want to authenticate docker for pulling image from ecr, to instantiate container of that. Is this functionality provided as as golang https://golang.testcontainers.org/features/docker_auth/?

guilleiguaran commented 1 year ago

@Koumudini-Sambre hey! Since testcontainers-ruby uses the docker-api gem underneath I think you can use the Docker.authenticate! command before creating any container (as described here:

# docker command for reference: docker login
Docker.authenticate!('username' => 'docker-fan-boi', 'password' => 'i<3docker', 'email' => 'dockerboy22@aol.com')
# => true

# docker command for reference: docker login registry.gitlab.com
Docker.authenticate!('username' => 'docker-fan-boi', 'password' => 'i<3docker', 'email' => 'dockerboy22@aol.com', 'serveraddress' => 'https://registry.gitlab.com/v1/')
# => true

Can you try it and report your findings here?

Koumudini-Sambre commented 1 year ago

Yes this works @guilleiguaran Thanks :)