Docker
Docker
docker ps:
docker images:
docker rm 140
docker rm 140e08c7c37b
docker ps -a
dir
cd .\SimpleImage\
docker build .
cat .\Dockerfile\
docker ps -a^C
cd..
mkdir
pwd
cd .\GA\
docker login
AWS
đứng tại file AWS -> docker-compose up -d -> test thử trên
webserver(http://localhost/blogg-api/Users) - > docker compose down
Set up
lên ứng dụng AWS ->EC2 ->Instance - > Launch instance -> Create Name
-> Ubuntu -> 64-bit(x86) ->t3.micro -> Create new key pair -> RSA -
>Pem-> create -> Network Setting ->Create security group -> choice all 3
options -> Launch.
Deploy docker-compose
-If you want to check web on URL, click Public IPv4 DNS, change https to
http after that type more /blogg-api(containername-api)/Users
-If you want to check on Mysql. Go to Instance, choose the instance are
running. Go down choose security, Security groups, Edit inbound rules,
Add rule, Type 3306, select 0.0.0.0/0, AnywhereIPV4, Save Rules. Copy
Public IPv4 address and past in hostname at MSQL. Port is 3306.
IAM ->Users ->Creat User-> Input User name -> choose provide user ->I
want to create an IAM user->Custom password-> type password-> user
must create a new password -> next-> Add user group ->choose group
or create -> nhan vao ten group to see info->next
Access Key
Users -> choice Users name -> Sercurity credentials -> Create access
key*2 ->choose CLI -> understand -> set description tag -> create ->
retrieve access key and use that key to aws configure(powersell)
aws --version: check the version -> ls -force ->cd .\.aws\ -> cat .\
credentials
*create repository
login to repository
create
aws ecr create-repository --repository-name ga-studblogg-api
aws ecr
create-repository --repository-name ga-studblogg-db
aws ecr
create-repository --repository-name ga-studblogg-web
// check on the aws webserver
go to docker hub
or
docker images
-docker push 730335426233.dkr.ecr.eu-north-1.amazonaws.com/ga-
studblogg-api:v1
ECS
Cluster -> create cluster -> input cluster name -> choose
Task definitions ->Create new -> input name for task definition family->
Infrastructure-> choose AWS
-> Container:
api
Name: gablogg-undervisning-api
ImagesURL:api
db
Name: gablogg-undervisning-db
ImagesURL:db
Web
Name: gablogg-undervisning-web
ImagesURL:web
check server
docker exec -it (container id of server)