- Open Sg port: 2377
- Open any other ports your app might need
- Install docker
- Install sawrm master
- Join swarm workers
- Create overlay
- deploy service / containers
#
# Install Docker
#
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo yum install -y git
sudo yum -y groupinstall "Development Tools"
docker version
docker network ls
#
# Create Master node Swarm
#
docker swarm init
docker node ls
#
# Create Overlay
#
docker network ls
docker network create --attachable -d overlay overnet
docker network ls
#
# Deploy Service, Test, SSH
#
docker service create --name myservice --network overnet --replicas 2 alpine sleep 1d
docker service ls
docker ps
docker service ps myservice
docker network inspect overnet
docker exec -it 66491d2e91e9 sh
ping 10.0.0.3
#
# Install Docker
#
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo yum install -y git
sudo yum -y groupinstall "Development Tools"
docker version
docker network ls
#
# Join Master Swarm as Worker
#
docker swarm join --token SWMTKN-1-2tla28a4oxh9sit59p3v1q325eizxmrofy87p72uggddwvet7p-5vmuq7ewk9m4vtxvkv5gdvfn9 172.28.198.251:2377
docker ps
docker network ls
docker inspect 2cd88f5c369f
More on:
https://www.youtube.com/watch?v=nGSNULpHHZc
https://docs.docker.com/engine/reference/commandline/service_create/#set-environment-variables--e-env