Skip to content

Commit d6e3dd6

Browse files
committed
Add "eval" to every invocation of "docker-machine env"
See http://unix.stackexchange.com/a/181581 for the rationale behind this change. Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
1 parent ff3b733 commit d6e3dd6

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ INFO[0000] Creating VirtualBox VM...
1313
INFO[0007] Starting VirtualBox VM...
1414
INFO[0007] Waiting for VM to start...
1515
INFO[0041] "dev" has been created and is now the active machine.
16-
INFO[0041] To point your Docker client at it, run this in your shell: $(docker-machine env dev)
16+
INFO[0041] To point your Docker client at it, run this in your shell: eval "$(docker-machine env dev)"
1717

1818
$ docker-machine ls
1919
NAME ACTIVE DRIVER STATE URL SWARM
2020
dev * virtualbox Running tcp://192.168.99.127:2376
2121

22-
$ $(docker-machine env dev)
22+
$ eval "$(docker-machine env dev)"
2323

2424
$ docker run busybox echo hello world
2525
Unable to find image 'busybox:latest' locally
@@ -35,7 +35,7 @@ INFO[0001] Creating Digital Ocean droplet...
3535
INFO[0002] Waiting for SSH...
3636
INFO[0070] Configuring Machine...
3737
INFO[0109] "staging" has been created and is now the active machine.
38-
INFO[0109] To point your Docker client at it, run this in your shell: $(docker-machine env staging)
38+
INFO[0109] To point your Docker client at it, run this in your shell: eval "$(docker-machine env staging)"
3939

4040
$ docker-machine ls
4141
NAME ACTIVE DRIVER STATE URL SWARM

commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ func cmdCreate(c *cli.Context) {
332332
case "fish":
333333
info = fmt.Sprintf("%s env %s | source", c.App.Name, name)
334334
default:
335-
info = fmt.Sprintf("$(%s env %s)", c.App.Name, name)
335+
info = fmt.Sprintf(`eval "$(%s env %s)"`, c.App.Name, name)
336336
}
337337

338338
log.Infof("%q has been created and is now the active machine.", name)

docs/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ $ docker-machine create -d virtualbox local
273273
Load the Machine configuration into your shell:
274274

275275
```
276-
$ $(docker-machine env local)
276+
$ eval "$(docker-machine env local)"
277277
```
278278
Then run generate the token using the Swarm Docker image:
279279

@@ -324,7 +324,7 @@ export DOCKER_HOST=tcp://192.168.99.100:3376
324324
```
325325

326326
You can load this into your environment using
327-
`$(docker-machine env --swarm swarm-master)`.
327+
`eval "$(docker-machine env --swarm swarm-master)"`.
328328

329329
Now you can use the Docker CLI to query:
330330

@@ -389,13 +389,13 @@ run in a subshell. Running `docker-machine env -u` will print
389389

390390
```
391391
$ env | grep DOCKER
392-
$ $(docker-machine env dev)
392+
$ eval "$(docker-machine env dev)"
393393
$ env | grep DOCKER
394394
DOCKER_HOST=tcp://192.168.99.101:2376
395395
DOCKER_CERT_PATH=/Users/nathanleclaire/.docker/machines/.client
396396
DOCKER_TLS_VERIFY=1
397397
$ # If you run a docker command, now it will run against that host.
398-
$ $(docker-machine env -u)
398+
$ eval "$(docker-machine env -u)"
399399
$ env | grep DOCKER
400400
$ # The environment variables have been unset.
401401
```

0 commit comments

Comments
 (0)