# Dockerize a Create React App in 2018
Moved <https://gist.github.com/johnoscott/df26d4e106c3aa9cc53cf1a8fdf6b297>
## Links
* <https://stackoverflow.com/questions/35774714/how-to-cache-the-run-npm-install-instruction-when-docker-build-a-dockerfile>
* 2014 - probably not relevant in 2018 <http://bitjudo.com/blog/2014/03/13/building-efficient-dockerfiles-node-dot-js/>
### Docker Compose How-To
Creates a virtual network for all the containers
Compose
docker-compose.yaml
```yaml
version: '3'
services:
product-service:
build: ./product
volumes:
- ./product:/usr/src/app
ports:
- 5001:80
website:
image: php:apache
volumes:
- ./website:/var/www/html
ports:
- 5000:80
depends_on:
- products:
```
### Compose and Run
`$ docker-compose up`
`$ docker-compose up -deep`
### What Containers are running ?
`$docker ps`
##
`docker compose`
# Docker Container
## Command Cheat Sheet
Markdown | Less | Pretty
--- | --- | ---
Intention | `command` | Comment
Delete an image | `docker image rmi react:app` | images can take a lot of space (e.g. 1GB for node)
1 | 2 | 3
## Terminology
* Image described by a `DockerFile` that
* build an image from DockerFile `$ docker ...`
* Container is a Run an image with `docker run`
```
[ DockerFile ] --- build ---> ( Image ) --- run ---> [ Container ]
```
## Learn Docker in 12 Minutes