Since I was making a web application in a local environment, I moved to a server on AWS. I had never set up a server on AWS, so I tried it while having an expert teach me. I'll forget it, so I'll leave the steps up to running docker on the server for myself in the future.
Here is the rough work procedure.
The actual procedure was as follows. However, this time, I will omit how to create an EC2 instance.
.pem
will be created, so save this as~ / .ssh /
.ssh xx.xxx.xx.xxx
but couldn't.ssh [email protected]
but couldn't.ssh -v [email protected]
ssh -i ~ / .ssh / xxx.pem [email protected] and entered with the xxx.pem
command. You can enter ubuntu using the key xxx.pem. It seems to be a command.ssh-keygen
. You will be asked three times, but if nothing else, just press Enter three times..ssh / id_rsa.pub
, so copy the contents and paste it in the place where you enter the public key on gitlab (it should have been set).sudo apt update
first and sudo apt install docker.io
.docker ps
. I didn't have permission, so I cast the spell sudo usermod -aG docker $ USER
.docker ps
to confirm.sudo apt install docker-compose
.docker-compose up
should start it. If you want to drop it, just do docker-compose down
or docker-compose stop
. By the way, if you want to run it in the background, you can do it with docker-compose up -d
.I migrated a web application running in a local docker environment to AWS. I talked about the contents until entering the AWS server and the contents until entering the server and running docker. Probably there are other ways, so please refer to it.
Recommended Posts