Skip to content

Commit

Permalink
Machine unset env var, Cloud updates (docker#3146)
Browse files Browse the repository at this point in the history
* added unset env instructions

Signed-off-by: Victoria Bialas <[email protected]>

* machine env details, cloud swarm updates, copyedits

Signed-off-by: Victoria Bialas <[email protected]>

* fix per review, add Azure to note

Signed-off-by: Victoria Bialas <[email protected]>
  • Loading branch information
londoncalling authored May 3, 2017
1 parent a5d6ded commit ab47785
Show file tree
Hide file tree
Showing 9 changed files with 197 additions and 60 deletions.
32 changes: 31 additions & 1 deletion docker-cloud/cloud-swarm/connect-to-swarm.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,37 @@ local Docker instance, which connects to a manager node on the target swarm.
7. Now that your swarm is set up, try out the example to [deploy a service to the swarm](/engine/swarm/swarm-tutorial/deploy-service/),
and other subsequent tasks in the Swarm getting started tutorial.
> **Note**: To switch back to Docker hosts you can either run the `export` command again to overwrite it, or use `unset DOCKER_HOST`. If you are using Docker Machine, be sure to unset `DOCKER_TLS_VERIFY` as described in the [known issues](https://github.com/moby/mobycloud-federation#known-issues).
## Switch between your swarm and Docker hosts in the same shell
To switch to Docker hosts:
* If you are running Docker for Mac or Docker for Windows, and want to connect to the Docker Engine for those apps, run `docker-machine env -u` as a preview, then run the unset command: `eval $(docker-machine env -u)`. For example:
```
$ docker-machine env -u
unset DOCKER_TLS_VERIFY
unset DOCKER_HOST
unset DOCKER_CERT_PATH
unset DOCKER_MACHINE_NAME
# Run this command to configure your shell:
# eval $(docker-machine env -u)
```
* If you are using Docker Machine, and want to switch to one of your local VMs, be sure to unset `DOCKER_TLS_VERIFY`. Best practice is similar to the previous step. Run `docker-machine env -u` as a preview, then run the unset command: `eval $(docker-machine env -u)`. Follow this with `docker machine ls` to view your current machines, then connect to the one you want with `docker-machine env my-local-machine` and run the given `eval` command. For example:
```
$ docker-machine env my-local-machine
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/victoriabialas/.docker/machine/machines/my-local-machine"
export DOCKER_MACHINE_NAME="my-local-machine"
# Run this command to configure your shell:
# eval $(docker-machine env my-local-machine)
```
To switch back to the deployed swarm, re-run the `export DOCKER_HOST` command with the connection port for the swarm you want to work with. (For example, `export DOCKER_HOST=tcp://127.0.0.1:32770`)
To learn more, see [Unset environment variables in the current shell](/machine/get-started/#unset-environment-variables-in-the-current-shell).
## Reconnect a swarm
Expand Down
2 changes: 1 addition & 1 deletion docker-cloud/cloud-swarm/create-cloud-swarm-azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Subscription you want to use.

> **Note**: At this time, you cannot add nodes to a swarm from
within Docker Cloud. To add new nodes to an existing swarm,
log in to your AWS account, and add nodes manually. (You can
log in to your Azure account, and add nodes manually. (You can
unregister or dissolve swarms directly from Docker Cloud.)

## Where to go next
Expand Down
2 changes: 1 addition & 1 deletion docker-cloud/cloud-swarm/link-aws-swarm.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Cloud to connect the account.

![](images/aws-creds-cloud.png)

You're now ready to deploy a swarm!
You are now ready to deploy a swarm!

## Where to go next

Expand Down
23 changes: 8 additions & 15 deletions docker-cloud/cloud-swarm/link-azure-swarm.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,19 @@ Go to Docker Cloud to connect the account.

![](images/azure-id-wizard.png)

3. Provide your subscription ID.
3. Provide your subscription ID and click **Save**.

You will be redirected to [Azure Cloud Services](portal.azure.com).

4. Log in to your Azure account.

5. Click **Accept** to grant Docker Cloud access to your Microsoft Azure account.

![](images/azure-permissions.png)

6. Your Microsoft Azure login credentials will automatically populate to
Docker Cloud under **Service Providers -> Microsoft Azure**.
This grants Docker Cloud access to your Microsoft Azure account, and links
the two accounts. Your Azure login credentials will automatically populate
to Docker Cloud under **Service Providers -> Microsoft Azure**.

![](images/azure-creds-cloud.png)

7. Click **Save**.

## Enable your Azure subscription for Docker Cloud

You need to verify Microsoft Azure terms of use and manually enable your Azure subscription on behalf of Docker Cloud.
You need to verify Microsoft Azure terms of use and manually enable your Azure subscription on behalf of Docker Cloud. You need do this only once, before you attempt to deploy a Docker Cloud Microsoft Azure swarm for the first time.

>**Tip:** If your Azure subscription is not enabled first, the swarm deployment will fail. The error will show up on your **Azure portal -> resource groups -> _ResourceGroupForYourSwarm_ -> deployments**.
1. Go to the [Microsoft Azure Marketplace](https://portal.azure.com/#blade/Microsoft_Azure_Marketplace/GalleryFeaturedMenuItemBlade/selectedMenuItemId/home) and search for **Docker**, or specifically **Docker for Azure CE**.

Expand All @@ -77,7 +70,7 @@ You need to verify Microsoft Azure terms of use and manually enable your Azure s

![](images/azure-eula-4-verify.png)

You're now ready to deploy a swarm!
You are now ready to deploy a swarm!

## Where to go next

Expand Down
78 changes: 62 additions & 16 deletions docker-for-mac/docker-toolbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@ redirect_from:
title: Docker for Mac vs. Docker Toolbox
---

If you already have an installation of Docker Toolbox, please read these topics first to learn how Docker for Mac and Docker Toolbox differ, and how they can coexist.
If you already have an installation of Docker Toolbox, please read these topics
first to learn how Docker for Mac and Docker Toolbox differ, and how they can
coexist.

## The Docker Toolbox environment

Docker Toolbox installs `docker`, `docker-compose` and `docker-machine` in `/usr/local/bin` on your Mac. It also installs VirtualBox. At installation time, Toolbox uses `docker-machine` to provision a VirtualBox VM called `default`, running the `boot2docker` Linux distribution, with [Docker Engine](/engine/) with certificates located on your Mac at `$HOME/.docker/machine/machines/default`.
Docker Toolbox installs `docker`, `docker-compose` and `docker-machine` in
`/usr/local/bin` on your Mac. It also installs VirtualBox. At installation time,
Toolbox uses `docker-machine` to provision a VirtualBox VM called `default`,
running the `boot2docker` Linux distribution, with [Docker Engine](/engine/)
with certificates located on your Mac at
`$HOME/.docker/machine/machines/default`.

Before you use `docker` or `docker-compose` on your Mac, you typically use the command `eval $(docker-machine env default)` to set environment variables so that `docker` or `docker-compose` know how to talk to Docker Engine running on VirtualBox.
Before you use `docker` or `docker-compose` on your Mac, you typically use the
command `eval $(docker-machine env default)` to set environment variables so
that `docker` or `docker-compose` know how to talk to Docker Engine running on
VirtualBox.

This setup is shown in the following diagram.

Expand All @@ -21,11 +31,14 @@ This setup is shown in the following diagram.

## The Docker for Mac environment

Docker for Mac is a Mac native application, that you install in `/Applications`. At installation time, it creates symlinks in `/usr/local/bin` for `docker` and `docker-compose`, to the version of the commands inside the Mac application bundle, in `/Applications/Docker.app/Contents/Resources/bin`.
Docker for Mac is a Mac native application, that you install in `/Applications`.
At installation time, it creates symlinks in `/usr/local/bin` for `docker` and
`docker-compose`, to the version of the commands inside the Mac application
bundle, in `/Applications/Docker.app/Contents/Resources/bin`.

Here are some key points to know about Docker for Mac before you get started:

* Docker for Mac does not use VirtualBox, but rather <a href="https://github.com/docker/HyperKit/" target="_blank">HyperKit</a>, a lightweight macOS virtualization solution built on top of Hypervisor.framework in macOS 10.10 Yosemite and higher.
* Docker for Mac does not use VirtualBox, but rather [HyperKit](https://github.com/docker/HyperKit/, a lightweight macOS virtualization solution built on top of Hypervisor.framework in macOS 10.10 Yosemite and higher.

* Installing Docker for Mac does not affect machines you created with Docker Machine. The install offers to copy containers and images from your local `default` machine (if one exists) to the new Docker for Mac HyperKit VM. If chosen, content from `default` is copied to the new Docker for Mac HyperKit VM, and your original `default` machine is kept as is.

Expand All @@ -37,9 +50,14 @@ This setup is shown in the following diagram.

![Docker for Mac Install](images/docker-for-mac-install.png)

With Docker for Mac, you get only one VM, and you don't manage it. It is managed by the Docker for Mac application, which includes autoupdate to update the client and server versions of Docker.
With Docker for Mac, you get only one VM, and you don't manage it. It is managed
by the Docker for Mac application, which includes autoupdate to update the
client and server versions of Docker.

If you need several VMs and want to manage the version of the Docker client or server you are using, you can continue to use `docker-machine`, on the same machine, as described in [Docker Toolbox and Docker for Mac coexistence](docker-toolbox.md#docker-toolbox-and-docker-for-mac-coexistence).
If you need several VMs and want to manage the version of the Docker client or
server you are using, you can continue to use `docker-machine`, on the same
machine, as described in [Docker Toolbox and Docker for Mac
coexistence](docker-toolbox.md#docker-toolbox-and-docker-for-mac-coexistence).


## Setting up to run Docker for Mac
Expand Down Expand Up @@ -67,17 +85,30 @@ If you need several VMs and want to manage the version of the Docker client or s

$ env | grep DOCKER

If you are using a Bash shell, you can use `unset ${!DOCKER_*}` to unset all DOCKER environment variables at once. (This will not work in other shells such as `zsh`; you will need to unset each variable individually.)
If you are using a Bash shell, you can use `unset ${!DOCKER_*}` to unset all
DOCKER environment variables at once. (This will not work in other shells such
as `zsh`; you will need to unset each variable individually.)

>**Note**: If you have a shell script as part of your profile that sets these `DOCKER` environment variables automatically each time you open a command window, then you will need to unset these each time you want to use Docker for Mac.
> **Warning**:
> If you install Docker for Mac on a machine where Docker Toolbox is installed, it will replace the `docker` and `docker-compose` command lines in `/usr/local/bin` with symlinks to its own versions.
> If you install Docker for Mac on a machine where Docker Toolbox is installed..
>
> Docker for Mac will replace the `docker` and `docker-compose` command lines in `/usr/local/bin` with symlinks to its own versions.
{:.warning}

See also [Unset environment variables in the current
shell](/machine/get-started.md#unset-environment-variables-in-the-current-shell)
in the Docker Machine topics.

## Docker Toolbox and Docker for Mac coexistence

You can use Docker for Mac and Docker Toolbox together on the same machine. When you want to use Docker for Mac, make sure all DOCKER environment variables are unset. You can do this in bash with `unset ${!DOCKER_*}`. When you want to use one of the VirtualBox VMs you have set with `docker-machine`, just run a `eval $(docker-machine env default)` (or the name of the machine you want to target). This will switch the current command shell to talk to the specified Toolbox machine.
You can use Docker for Mac and Docker Toolbox together on the same machine. When
you want to use Docker for Mac, make sure all DOCKER environment variables are
unset. You can do this in bash with `unset ${!DOCKER_*}`. When you want to use
one of the VirtualBox VMs you have set with `docker-machine`, just run a `eval
$(docker-machine env default)` (or the name of the machine you want to target).
This will switch the current command shell to talk to the specified Toolbox
machine.

This setup is represented in the following diagram.

Expand All @@ -86,14 +117,25 @@ This setup is represented in the following diagram.

## Using different versions of Docker tools

The coexistence setup works as is as long as your VirtualBox VMs provisioned with `docker-machine` run the same version of Docker Engine as Docker for Mac. If you need to use VMs running older versions of Docker Engine, you can use a tool like <a href="https://github.com/getcarina/dvm" target="_blank">Docker Version Manager</a> to manage several versions of docker client.
The coexistence setup works as is as long as your VirtualBox VMs provisioned
with `docker-machine` run the same version of Docker Engine as Docker for Mac.
If you need to use VMs running older versions of Docker Engine, you can use a
tool like [Docker Version Manager](https://github.com/getcarina/dvm) to manage
several versions of docker client.


### Checking component versions

Ideally, the Docker CLI client and Docker Engine should be the same version. Mismatches between client and server, and among host machines you might have created with Docker Machine can cause problems (client can't talk to the server or host machines).
Ideally, the Docker CLI client and Docker Engine should be the same version.
Mismatches between client and server, and among host machines you might have
created with Docker Machine can cause problems (client can't talk to the server
or host machines).

If you already have <a href="/toolbox/overview/" target="_blank">Docker Toolbox</a> installed, and then install Docker for Mac, you might get a newer version of the Docker client. Run `docker version` in a command shell to see client and server versions. In this example, the client installed with Docker for Mac is `Version: 1.11.1` and the server (which was installed earlier with Toolbox) is Version: 1.11.0.
If you already have [Docker Toolbox](/toolbox/overview/) installed, and then
install Docker for Mac, you might get a newer version of the Docker client. Run
`docker version` in a command shell to see client and server versions. In this
example, the client installed with Docker for Mac is `Version: 1.11.1` and the
server (which was installed earlier with Toolbox) is Version: 1.11.0.

$ docker version
Client:
Expand All @@ -104,7 +146,11 @@ If you already have <a href="/toolbox/overview/" target="_blank">Docker Toolbox<
Version: 1.11.0
...

Also, if you created machines with Docker Machine (installed with Toolbox) then upgraded or installed Docker for Mac, you might have machines running different versions of Engine. Run `docker-machine ls` to view version information for the machines you created. In this example, the DOCKER column shows that each machine is running a different version of server.
Also, if you created machines with Docker Machine (installed with Toolbox) then
upgraded or installed Docker for Mac, you might have machines running different
versions of Engine. Run `docker-machine ls` to view version information for the
machines you created. In this example, the DOCKER column shows that each machine
is running a different version of server.

$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
Expand All @@ -114,7 +160,7 @@ Also, if you created machines with Docker Machine (installed with Toolbox) then

You might also run into a similar situation with Docker Universal Control Plan (UCP).

There are a few ways to address this problem and keep using your older machines. One solution is to use a version manager like <a href="https://github.com/getcarina/dvm" target="_blank">DVM</a>.
There are a few ways to address this problem and keep using your older machines. One solution is to use a version manager like [DVM](https://github.com/getcarina/dvm).

## How do I uninstall Docker Toolbox?

Expand Down
8 changes: 4 additions & 4 deletions machine/examples/aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ keywords: docker, machine, cloud, aws
title: Amazon Web Services (AWS) EC2 example
---

Follow along with this example to create a Dockerized <a href="https://aws.amazon.com/" target="_blank"> Amazon Web Services (AWS)</a> EC2 instance.
Follow along with this example to create a Dockerized [Amazon Web Services (AWS)](https://aws.amazon.com/) EC2 instance.

### Step 1. Sign up for AWS and configure credentials

1. If you are not already an AWS user, sign up for <a href="https://aws.amazon.com/" target="_blank"> AWS</a> to create an account and get root access to EC2 cloud computers.
1. If you are not already an AWS user, sign up for [AWS](https://aws.amazon.com/) to create an account and get root access to EC2 cloud computers.

If you have an Amazon account, you can use it as your root user account.

Expand All @@ -22,7 +22,7 @@ Follow along with this example to create a Dockerized <a href="https://aws.amazo

* an AWS Secret Access Key

See the AWS documentation on <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html" target="_blank">Setting Up with Amazon EC2</a>. Follow the steps for "Create an IAM User" and "Create a Key Pair".
See the AWS documentation on [Setting Up with Amazon EC2](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html). Follow the steps for "Create an IAM User" and "Create a Key Pair".

### Step 2. Use Machine to create the instance

Expand Down Expand Up @@ -70,7 +70,7 @@ Follow along with this example to create a Dockerized <a href="https://aws.amazo
default - virtualbox Running tcp://192.168.99.100:2376 v1.10.0-rc4
aws-sandbox - digitalocean Running tcp://104.131.43.236:2376 v1.9.1

The new `aws-sandbox` instance is running, and it is the active host as indicated by the asterisk (*). When you create a new machine, your command shell automatically connects to it. If for some reason your new machine is not the active host, you'll need to run `docker-machine env aws-sandbox`, followed by `eval $(docker-machine env aws-sandbox)` to connect to it.
The new `aws-sandbox` instance is running, and it is the active host as indicated by the asterisk (\*). When you create a new machine, your command shell automatically connects to it. If for some reason your new machine is not the active host, you'll need to run `docker-machine env aws-sandbox`, followed by `eval $(docker-machine env aws-sandbox)` to connect to it.

### Step 3. Run Docker commands on the instance

Expand Down
Loading

0 comments on commit ab47785

Please sign in to comment.