New in version 2.0.
Ansible version of the “docker login” CLI command. This module allows you to login to a Docker registry without directly pulling an image or performing any other actions. It will write your login credentials to your local .dockercfg file that is compatible to the Docker CLI client as well as docker-py and all other Docker related modules that are based on docker-py.
- python >= 2.6
- docker-py >= 1.1.0
parameter | required | default | choices | comments |
---|---|---|---|---|
docker_url |
no | unix://var/run/docker.sock | Refers to the protocol+hostname+port where the Docker server is hosted | |
dockercfg_path |
no | ~/.docker/config.json | Use a custom path for the .dockercfg file | |
email |
no | None | The email address for the registry account. Note that private registries usually don't need this, but if you want to log into your Docker Hub account (default behaviour) you need to specify this in order to be able to log in. | |
password |
yes | The plaintext password for the registry account | ||
reauth |
no | Whether refresh existing authentication on the Docker server (boolean) | ||
registry |
no | https://index.docker.io/v1/ | URL of the registry, defaults to: https://index.docker.io/v1/ | |
timeout |
no | 600 | The HTTP request timeout in seconds | |
username |
yes | The username for the registry account |
Login to a Docker registry without performing any other action. Make sure that the user you are using is either in the docker group which owns the Docker socket or use sudo to perform login actions: - name: login to DockerHub remote registry using your account docker_login: username: docker password: rekcod email: docker@docker.io - name: login to private Docker remote registry and force reauthentification docker_login: registry: your.private.registry.io username: yourself password: secrets3 reauth: yes - name: login to DockerHub remote registry using a custom dockercfg file location docker_login: username: docker password: rekcod email: docker@docker.io dockercfg_path: /tmp/.mydockercfg
For more information on what this means please read Extras Modules
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.