1

On OSX I'm creating a docker-machine as follows:

docker-machine create --driver=virtualbox --tls-san dockerhost docker

And added to /etc/hosts (I've also tried the reverse):

192.168.99.100 dockerhost

And using docker-py to connect to the docker-machine:

machine_name = 'docker'
machine_ip = '192.168.99.100' #from docker-machine env docker
CERTS = os.path.join(os.path.expanduser('~'), '.docker', 'machine', 'machines', machine_name)
tls_config = docker.tls.TLSConfig(
    client_cert=(os.path.join(CERTS, 'cert.pem'), os.path.join(CERTS,'key.pem')),
    ca_cert=os.path.join(CERTS, 'ca.pem'),
    verify=True
)
cli = docker.Client(base_url='https://' + machine_ip + ':2376' , tls=tls_config)

This gives the error:

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://192.168.99.100:2376/v1.21/containers/create

I"m at a loss why requests can't find the machine. Any idea what's wrong with my setup?

Berco Beute
  • 1,115
  • 15
  • 30

1 Answers1

0

I had the same issue. This is what I did:

My error message was longer had this too:

docker.errors.APIError: 400 Client Error: Bad Request ("b'client version 1.2.1 is too old. Minimum supported API version is 1.12, please upgrade your client to a newer version'")

I upgraded docker using docker-machine upgrade default and then added the version to your code:

cli = docker.Client(base_url='https://' + machine_ip + ':2376' , tls=tls_config, version='1.12.1')

print (cli.images()) returns the images I have

letsc
  • 2,515
  • 5
  • 35
  • 54