markdown [Docker HowtTo]如何创建Docker容器#docker #howto

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown [Docker HowtTo]如何创建Docker容器#docker #howto相关的知识,希望对你有一定的参考价值。

# 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 

以上是关于markdown [Docker HowtTo]如何创建Docker容器#docker #howto的主要内容,如果未能解决你的问题,请参考以下文章

markdown [Docker命令]删除容器等#docker

markdown [Docker Cheat Sheet] #docker

markdown docker:docker命令要点

markdown [Docker笔记] #Docker #tips #code

markdown Docker Engine与Docker Machine

markdown [Docker] Docker片段列表和命令#linux #docker #snippets