Skip to main content

Private Docker registry

Say you want to use a private Docker image in your CI configuration:

version: '1'
jobs:
test:
image: docker.company.com/my-image
script:
- npm test

Add a secret with the content of a Docker JSON config file. For example, we'll name it DOCKER_AUTH_JSON and set its content to:

{"auths": {"docker.company.com": {"auth": "<your-token>"}}}

Make sure to convert the content of your Docker auth file to a single line to avoid YAML format issues.

Now, use the secret to set the docker.auth property in your config:

version: '1'
docker:
auth: '{{DOCKER_AUTH_JSON}}'
jobs:
test:
image: docker.company.com/my-image
script:
- npm test