Docker-Compose
Need of docker-compose
The big purpose of Docker compose is not only to automate some of these long winded commands it's also to make sure that we have the ability to easily start up multiple docker containers at the same time and connect them together in some automated fashion.
Now to make use of Docker compose we're essentially going to take the same commands that we are running before like dock or build in dock or run but we're going to kind of encode these commands into a very special file in our project directory called docker-compose.yml
Sample Diagram of docker-compose file
docker-compose example
In above examample
version is the version of docker-compose we are using
services - services are different docker container we are going to use , here we are using 2 containers
one is redis and second is node-app container whose docker file we have written . since we
have written its file , so build . command will search for a docker file and execute it.
ports - ports are mapping of local host ports and docker ports.
Restart policies
The big purpose of Docker compose is not only to automate some of these long winded commands it's also to make sure that we have the ability to easily start up multiple docker containers at the same time and connect them together in some automated fashion.
Now to make use of Docker compose we're essentially going to take the same commands that we are running before like dock or build in dock or run but we're going to kind of encode these commands into a very special file in our project directory called docker-compose.yml
Sample Diagram of docker-compose file
docker-compose example
In above examample
version is the version of docker-compose we are using
services - services are different docker container we are going to use , here we are using 2 containers
one is redis and second is node-app container whose docker file we have written . since we
have written its file , so build . command will search for a docker file and execute it.
ports - ports are mapping of local host ports and docker ports.
Restart policies
Comments
Post a Comment