Version:- Specifies the docker-Compose 'version:' and this version does't relate directly to the version of docker-compose that you have installed this is just a version of docker-compose file format that we wish to write.
Services:- This section defines the containers that will be started as a part of the Docker Compose instance.
Networks:- This section is used to configure networking for your application. You can change the settings of the default network, connect to an external network, or define app-specific networks.
Volumes:- Mounts a linked path on the host machine that can be used by the container.
Image:- Sets the image that will be used to build the container and also use existing docker file from Docker Hub.
Build:- Specifies the location of the Dockerfile that will be used to build the container.
Name_of_service:- name_of_service is a keyword that used to define number of separate services. like:- db and web
Restart:- Tells the container to restart if the system restarts.
Environment:- Environment variables are available to processes running inside of Docker containers.
Depends_on:- Docker-compose up starts services in dependency order.
Port:- Ports in the HOST:CONTAINER format, container build in container port and we can browse it in host port
Link:- Link this service to any other services in the Docker Compose file by specifying their names here.
command: python manage.py
From:- Name of the base image that used to start the process.
Run:- It takes a command as its argument and runs it to form the image.
Add:- Add command gets two arguments a source and a destination. It basically copies the files from the source on the host into the container's own filesystem at the set destination. COPY and ADD are both Dockerfile instructions that use for similar purposes.
WORKDIR: The WORKDIR directive is used to set where the command defined with CMD is to be executed.
ENTRYPOINT:- ENTRYPOINT argument sets the concrete default application that is used every time a container is created using the image.
ENV:- ENV command is used to set the environment variables.
CMD:- CMD can be used for executing a specific command within the container.
EXPOSE:- A specific port to enable networking between the container and the outside world.
COPY . /app
RUN make /app
CMD python /app/app.py
Subscribe to Blog | Paradise TechSoft Solutions Pvt. Ltd
Get the latest posts delivered right to your inbox