Docker Compose is a tool for defining and running Docker programs that use multi-containers. With Docker Compose, we use a YAML file to set up the necessary services for the program. Finally, with one command, we will create and start all services from those settings.
Using Compose typically involves the following three steps:
Declare the program’s environments in Dockerfile.
Declare the necessary services for the program in the docker-compose.yml file so that the services can run together in an environment.
Run the docker-compose up command to start Compose and run the program.
Compose has commands that allow you to manage your program’s lifecycle:
Start, Stop and Rebuild the service.
View the status of running services.
View the log output of the running service.
Run a one-off command in a service.
Create multiple isolated environments in one host: Compose isolates the environments of projects to ensure they don’t conflict with each other, and makes it easy to make copies of an environment.
Recreate only changed containers: Compose will recognize the services that have not changed and reuse the containers corresponding to that service.
Adjust variables used for environments: Compose uses variables in the Compose file for environments. So with different environments or users, it is possible to adjust variables when using Compose to set up services.
git clone https://github.com/AWS-First-Cloud-Journey/AWS-FCJ-Management.git
ls
touch .env
en .env
Then execute the configuration and save it with the command !wq
cat .env
cat docker-compose.yaml
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo chkconfig docker on
Then install the latest docker-compose version
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker- compose
We will give permission to docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Check the installation is successful
docker-compose version
docker-compose up --build
aws ecs describe-task-definition --task-definition aws-fcj-task-def