How to run docker-compose on EC2 AWS

preview_player
Показать описание
In this video I want to show you how to run an application with docker-compose on an Amazon AWS EC2 instance.
This might be preferred for a hobby project or when you want to make your application quickly available.

Self-hosting like this is discouraged for production applications, I would rather recommend managed solutions like Amazon EKS or ECS. I'll demonstrate EKS and ECS in future videos.

This video might encourage you to try out Amazon AWS for your hobby project. AWS is a stable in the industry and very valuable tool to master.

#aws #docker #dockercompose #ec2 #selfhosted

SSH into the machine:
chmod 0400 PEM_FILE.pem

Error Logs:

How to mount a volume:

Demo application with nginx and docker-compose files:

Copy files into your instance with scp:

Want to automate what is presented in this Video with the help of AWS Cloud Formation?
Then please check out this Video:

Twitter:
#kobbikobb
Рекомендации по теме
Комментарии
Автор

included .env file in docker compose but couldnt pull it in instance. Now should i copy .env file also there?

SnowTech-fzux
Автор

nice tutorial, can you share de codes en minute 2.23 (that paste in field - User Data) please?

freddyasencios
Автор

Why we have created a mount "/data"? I assume that we just copy files into /home directory, how volume "/data" is involved here?

Yoruplays
Автор

i don't know why i am not able to access the endpoints using public IP but its possible using private IP, i tested using curl command, I even checked security group, it is correct. Any suggestion

ashuthoshsk
Автор

I am trying to deploy a `docker-compose.yaml` on a public cloud VM. There is no other file I would like to deploy

My file that contains 3 images to build the container (see code below): Kafka Broker, Zookeeper and Python-Producer (which basically just produces random numbers periodically and writes to a Kafka Topic; and this image is deployed publicly).

I have followed 2 comprehensive tutorials on how to deploy a container on VM using GCP & AWS EC2 meticulously. But I am getting the following errors

- On AWS EC2 on Linux → I am unable to install docker-compose engine
- On GCP VM on Ubuntu → I am able to run docker-compose up command but it throws an error stating the broker cannot be started



version: '2'

services:
zookeeper:
image:
hostname: zookeeper
container_name: zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000

broker:
image: confluentinc/cp-kafka:latest
hostname: broker
container_name: broker
depends_on:
- zookeeper
ports:
- "29092:29092"
- "9092:9092"
- "9101:9101"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
PLAINTEXT:PLAINTEXT, PLAINTEXT_HOST:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092, PLAINTEXT_HOST://localhost:9092
1
1
1
0

producer:
image: daftpunkapi/flink_v1:latest
depends_on:
- broker
restart: "on-failure"

Any help and guidance will be much appreciated - TIA!

bx
Автор

hallo, i following the video but i have an issue when i SSH into the machine.

This part works well:
"chmod 0400 PEM_FILE.pem
but when i check if docker has been installed, its says "Command not found"
Funny fact, docker-compose has been installed but not docker

alecalabro
Автор

I am really confused at te point 7:24,
I am on a windows os, and i moved my pem file to the directory of the project, so when i type this command above i get ''no such file or directory error'', please can u explain what is needed to be done, and also when creating my data file, it threw a warning saying directory data exists

freepaidbeats