Skip to content
This repository was archived by the owner on Feb 27, 2018. It is now read-only.
This repository was archived by the owner on Feb 27, 2018. It is now read-only.

|boot2docker up| should mention the replacement to the broken '$(boot2docker shellinit)' pattern #369

@edmorley

Description

@edmorley

In #356, single quotes were added around the value assigned to DOCKER_CERT_PATH on Windows.

This results in output like:

[~/src]$ boot2docker shellinit
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\ca.pem
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\cert.pem
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\key.pem
    export DOCKER_TLS_VERIFY=1
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH='C:\Users\Ed\.boot2docker\certs\boot2docker-vm'

Copying and pasting the export lines above and running them by hand (or adding to .profile) works fine.

However when using $(boot2docker shellinit) the quotes actually end up in the value assigned to DOCKER_CERT_PATH, which causes an error when trying to use Docker. eg:

[~/src]$ $(boot2docker shellinit)
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\ca.pem
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\cert.pem
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\key.pem
[~/src]$ echo $DOCKER_CERT_PATH
'C:\Users\Ed\.boot2docker\certs\boot2docker-vm'
[~/src]$ docker ps
FATA[0000] Couldn't read ca cert 'C:\Users\Ed\.boot2docker\certs\boot2docker-vm'\ca.pem: open 'C:\Users\Ed\.boot2docker\certs\boot2docker-vm'\ca.pem: The filename, directory name, or volume label syntax is incorrect.

Which leaves a bit of a dilemma: If shellinit doesn't output the quotes, then the manual method breaks, if it does output the quotes, then the $(boot2docker shellinit) method breaks.

It seems the only way to get a value that works for both, is to remove the quotes, and replace all backslashes with double backslashes, eg:

[~/src]$ $(boot2docker shellinit | sed -e s_\'__g -e 's_\\_\\\\_g')
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\ca.pem
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\cert.pem
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\key.pem
[~/src]$ echo $DOCKER_CERT_PATH
C:\\Users\\Ed\\.boot2docker\\certs\\boot2docker-vm
[~/src]$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS
NAMES
[~/src]$ boot2docker shellinit | sed -e s_\'__g -e 's_\\_\\\\_g'
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\ca.pem
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\cert.pem
Writing C:\Users\Ed\.boot2docker\certs\boot2docker-vm\key.pem
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=C:\\Users\\Ed\\.boot2docker\\certs\\boot2docker-vm
    export DOCKER_TLS_VERIFY=1
[~/src]$ export DOCKER_CERT_PATH=C:\\Users\\Ed\\.boot2docker\\certs\\boot2docker-vm
[~/src]$ echo $DOCKER_CERT_PATH
C:\Users\Ed\.boot2docker\certs\boot2docker-vm
[~/src]$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS
NAMES

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions