Skip to content

Commit b52feb1

Browse files
committed
Docker compose basic templates
1 parent 1ece040 commit b52feb1

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3.1' # if no version is specificed then v1 is assumed. Recommend v2 minimum
2+
3+
services: # containers. same as docker run
4+
servicename: # Unique | a friendly name. this is also DNS name inside network
5+
image: # Optional if you use build:
6+
command: # Optional, replace the default CMD specified by the image
7+
environment: # Optional, same as -e in docker run
8+
volumes: # Optional, same as -v in docker run
9+
servicename2: # Unique | Another friendly service name.
10+
11+
volumes: # Optional, same as docker volume create
12+
13+
networks: # Optional, same as docker network create
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '2'
2+
3+
# same as
4+
# docker run -p 80:4000 -v $(pwd):/site bretfisher/jekyll-serve
5+
6+
services:
7+
jekyll:
8+
image: bretfisher/jekyll-serve
9+
volumes:
10+
- .:/site
11+
ports:
12+
- '80:4000'
13+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '2'
2+
3+
services:
4+
5+
wordpress:
6+
image: wordpress
7+
ports:
8+
- 8080:80
9+
environment:
10+
WORDPRESS_DB_HOST: mysql
11+
WORDPRESS_DB_NAME: wordpress
12+
WORDPRESS_DB_USER: example
13+
WORDPRESS_DB_PASSWORD: examplePW
14+
volumes:
15+
- ./wordpress-data:/var/www/html
16+
17+
mysql:
18+
image: mariadb
19+
environment:
20+
MYSQL_ROOT_PASSWORD: examplerootPW
21+
MYSQL_DATABASE: wordpress
22+
MYSQL_USER: example
23+
MYSQL_PASSWORD: examplePW
24+
volumes:
25+
- mysql-data:/var/lib/mysql
26+
27+
volumes:
28+
mysql-data:

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,14 @@ Open-sourced software licensed under the [MIT license](http://opensource.org/lic
559559
* CLI tool `docker-compose`:
560560
- Used for local dev/test automation with those `YAML` files to simplify our Docker commands.
561561

562+
```diff
563+
+ docker-compose.yml
564+
```
565+
- It was originally called `Fig` (years a go).
566+
- Compose YAML format has it's own versions. For e.g. `1, 2, 2.1, 3, 3.1` etc.
567+
- It can be used with `docker-compose` command for local Docker automation or can now be used (`v1.13 and above`) directly with the Docker command line in `production` with `swarm`.
568+
- `docker-compose.yml` is the default filename, but any other filename can be used with `docker-compose -f` option, as long as it's a proper `YAML`.
569+
562570
----------------------------------------
563571

564572
## Generic Examples

0 commit comments

Comments
 (0)