Closed
Description
Example:
import docker
from io import BytesIO
dockerfile="""
FROM <some-private-image-on-docker-hub>
CMD ["ls"]
"""
f = BytesIO(dockerfile.encode('utf-8'))
client = docker.APIClient(version='auto')
client.login(username='<user>', password='<pass>')
for l in client.build(fileobj=f, rm=True, tag='test', stream=True, pull=True):
print(l)
This example will error saying that it failed to find the image in FROM. If you add the full registry:
client = docker.APIClient(version='auto')
client.login(username='<user>', password='<pass>', registry='https://index.docker.io/v1/')
It will succeed. If you leave off the trailing slash on the registry url, it will fail.
python 3.5.2
docker-py 2.4.2