Skip to content

Commit

Permalink
Merge pull request #22 from dwyl/mac-setup
Browse files Browse the repository at this point in the history
#20 Mac setup
  • Loading branch information
nelsonic committed Mar 21, 2019
2 parents 9d4482e + 9975ac5 commit ec365a1
Showing 1 changed file with 45 additions and 46 deletions.
91 changes: 45 additions & 46 deletions README.md
Expand Up @@ -59,74 +59,73 @@ to test it out for yourself!

### Installation

If your laptop/pc is not running Linux you will need to
Download the Docker Toolkit**.pkg** (Mac)
or docker-toolkit.**exe** (Windows)
and *install* it on your Mac/PC.

+ Mac: http://docs.docker.com/installation/mac/
+ Windows: http://docs.docker.com/installation/windows/
+ Mac: https://docs.docker.com/docker-for-mac/install/
+ Windows: https://docs.docker.com/docker-for-windows/install/
+ Linux: you already have LXC but can install a native docker package
by clicking "Linux" and selecting your distro from the list or installing
a binary: http://docs.docker.com/installation/binaries/
a binary: https://docs.docker.com/install/linux/docker-ce/binaries/

![docker-toolbox-453-mb](https://cloud.githubusercontent.com/assets/194400/9295494/94ddc882-4467-11e5-9212-d9a506081764.png)
Mac example walk through:

Sadly, Docker Toolkit is the "*official*" way of running docker on Mac
so we have to swallow the **453Mb** pill
and get on with it! (*click install*!)
1. Create a Docker Hub account: https://hub.docker.com/ You need an account to
be able to download Docker Desktop. Docker Hub lets you store your docker files
(public & private) so you can share these with people and deploy them anywhere.

![docker-toolkit-installation-summary](https://cloud.githubusercontent.com/assets/194400/9295486/5094de68-4467-11e5-9bab-e3a3957388b8.png)
2. Download Docker Desktop for Mac: https://hub.docker.com/editions/community/docker-ce-desktop-mac
The file is **546.8MB** and you need Mac OS Sierra or later, and to have at
least 4GB of RAM.

###聽Next Steps
3. Install Docker Desktop on your Mac.
Open the `docker.dmg` file you downloaded, and drag the Docker app's whale icon
into your Applications folder.

You might as well get a **Docker Hub** account now
(reserve your username on dockerhub): https://hub.docker.com/
Docker Hub lets you store your docker files (public & private)
so you can share these with people and deploy them anywhere.
![drag-docker-to-applications](https://user-images.githubusercontent.com/16775804/54625627-8bdb4200-4a67-11e9-9b9d-891d20ea359c.png)

4. Open and run Docker
When you run the Docker app, a little whale icon will appear on the right-hand
side of the menu bar at the top of your screen. It might take a few minutes to
get running, and Docker may ask your permission to use services on your computer.
The app will also prompt you to enter your Docker Hub account details.

## Open the Docker *Quickstart* Terminal App

Open the Docker Quickstart Terminal App
## Once installed

![use-spotlight-to-open-quickstart-app](https://cloud.githubusercontent.com/assets/194400/9295603/1f01466c-446b-11e5-97aa-71a051bc5301.png)
Once you've installed Docker, opened it and signed in to your account you can
now open a command-line terminal, and try out some Docker commands.

This will open your terminal and run the boot script (*wait a couple of minutes for it to finish*...)
![quickstart](https://cloud.githubusercontent.com/assets/194400/9295558/9b636dea-4469-11e5-9758-d7e8d16de06d.png)
- Try `docker version` to check that you have the latest release installed.

Run the suggested command:
- Or run `docker run hello-world` to verify that Docker is pulling images and running as expected.

```sh
$ docker run hello-world
```
You should see something like this in your terminal:

![docker-configured](https://cloud.githubusercontent.com/assets/194400/9295567/f0e26b4a-4469-11e5-9c0e-1296c306c93c.png)
![docker-configured](https://user-images.githubusercontent.com/16775804/54629658-f2645e00-4a6f-11e9-8ce0-139243a022d6.png)


Next try to run an ubuntu container (*only do this on a fast internet connection as its going to download 65mb ubuntu image*)
As it suggests, next try to run an ubuntu container (*only do this on a fast
internet connection as its going to download 65mb ubuntu image*)

```sh
docker run -it ubuntu bash
```
![download ubuntu](https://cloud.githubusercontent.com/assets/194400/9295584/8137df40-446a-11e5-9b4c-b6af7b59c0b7.png)
![download ubuntu](https://user-images.githubusercontent.com/16775804/54629793-39eaea00-4a70-11e9-91c3-328132251a00.png)

This will boot the Ubuntu image and log you into the container's bash.
You can confirm that you are in a Linux bash by running the following
command: `cat /etc/os-release`

![confirm-running-ubuntu](https://cloud.githubusercontent.com/assets/194400/9295641/202ed328-446c-11e5-8c19-15b8a2ae2b28.png)
![confirm-running-ubuntu](https://user-images.githubusercontent.com/16775804/54629885-69015b80-4a70-11e9-976d-c25b34373a6a.png)

List the containers currently running:
List the containers:

```sh
docker-machine ls
docker container ls
```
Which shows:
```sh
NAME ACTIVE DRIVER STATE URL SWARM
default virtualbox Running tcp://192.168.99.100:2376
```

![docker-container-ls](https://user-images.githubusercontent.com/16775804/54669601-b241c180-4ae9-11e9-9bf5-e246b1cfa6aa.png)

See: https://docs.docker.com/engine/reference/commandline/container_ls/ for ways
to make this command more specific.

And for even more detail, run `docker info`

Expand Down Expand Up @@ -171,14 +170,14 @@ Then run the image as a container:
```sh
docker run -it -p 8888:8888 learn-docker bash
```
> https://docs.docker.com/reference/run/
> https://docs.docker.com/v17.09/engine/reference/commandline/run/
Exec
Exec (for running a command in a running container)

```sh
docker exec -it learn-docker bash
```

> https://docs.docker.com/v17.09/engine/reference/commandline/exec/
### List (*Locally Available*) Images

Expand All @@ -205,7 +204,7 @@ To list all the running docker containers, use:
docker ps -a
```

> https://docs.docker.com/reference/commandline/ps/
> https://docs.docker.com/v17.09/engine/reference/commandline/ps/
### More info on a specific container

Expand All @@ -231,7 +230,7 @@ where the last argument is the container (image) id.
docker stop a205fc3a096f
```

> https://docs.docker.com/reference/commandline/stop/
> https://docs.docker.com/v17.09/engine/reference/commandline/stop/
## Help!

Expand All @@ -245,7 +244,7 @@ looked at:

+ http://askubuntu.com/questions/443775/nginx-failing-to-reload-how-to-track-down-why

Test that your nginx configuration is valid (doen't have errors)
Test that your nginx configuration is valid (doesn't have errors)
```sh
sudo nginx -t
```
Expand Down Expand Up @@ -320,7 +319,7 @@ config :app_name, AppName.Repo,
pool_size: 10
```

Use `docker-compose` if you want to run some commands, for example to create the database:
Use `docker-compose` if you want to run commands, for example to create the database:

`docker-compose run web mix ecto.create`

Expand All @@ -344,6 +343,6 @@ https://www.youtube.com/watch?v=Q5POuMHxW-0 47mins - 2mins of *content*!
https://www.youtube.com/watch?v=XCVOxht34Hs 25mins - relevant to developers

### Tutorials

- https://www.imore.com/how-run-docker-your-mac
- http://blog.xebia.com/2014/06/18/deploying-a-node-js-app-to-docker-on-coreos-using-deis/
- https://medium.com/@dscape/getting-started-with-docker-for-the-node-js-couchdb-programmer-35c45ce2a814

0 comments on commit ec365a1

Please sign in to comment.