Dev, Sec & Ops
Published in

Dev, Sec & Ops

Docker 101: Docker Compose

A beginner’s introduction to Docker & why it’s awesome?

Let’s recap!

Docker Compose

$ docker run aditya12anand/webapp
$ docker run mongodb
$ docker run redis:alpine
$ docker run ansible
Docker Compose - yaml file
$ docker-compose up

Voting Application

$ docker run -d --name=redis redis
$ docker run -d --name=db postgres:9.4
$ docker run -d --name=vote -p 5000:80 --link redis:redis voting-app
$ docker run -d --name=result -p 5001:80 --link db:db result-app
$ docker run -d --name=worker --link db:db --link redis:redis worker
image: <image-name>
ports: 
- <host-port>:<docker-port>
links:
- <container-name>
build: ./<image-location>

Versions of Docker Compose

Different version of Docker Compose

Networking in Docker Compose

Architecture of Docker cluster
versions: 2services:    
redis:
image: redis
networks:
- back-end
db:
image: postgres:9.4
networks:
- back-end
vote:
image: voting-app
ports:
- 5000:80
depends_on:
- redis
networks:
- front-end
- back-end
result:
image: result-app
ports:
- 5000:80
depends_on:
- db
networks:
- front-end
- back-end
worker:
image: worker
depends_on:
- redis
- db
networks:
- back-end
networks:
front-end:
back-end:
networks:
- <network-name-1>:
- <network-name-2>:

Conclusion

Credits

Follow us on Dev, Sec & Ops to read related articles.

--

--

This is to give you guys a closer look at the DevSecOps world. The new technologies that are used to deploy these amazing services we love, the security work that goes into it and the operations that take place behind the scenes.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store