-Use the Docker registry (Docker hub) ・ Send Dockerfile ・ Send Docker image as tar
Access with SSH when using the shell. If you log in with SSH, you can install Docker on your AWS instance.
SSH ・ ・ ・ secure shell Launch a shell to secure
ssh -i xx.pem username@hostname
xx.pem ・ ・ ・ Key file downloaded when the server was set up -i ・ ・ ・ Option to specify the key file
Example) ssh -i mydocker.pem ubuntu@ec2 ・ ・ ・ .amazonaws.com
-Access the server with SSH. ssh -i xx.pem username@hostname ・ Update the package sudo apt-get update ・ Install docker sudo apt-get install docker.io
※sudo gpasswd -a ubuntu docker By creating a group called docker and putting ubuntu in it, people who belong to the group can use docker. When using docker on ubuntu server, basically do it (It will be possible to execute without sudo)
Send the Docker image as a tar.
docker save image ID> arbitrary file name.tar docker save fd867gy7fg > myimage.tar
Files can be transferred by accessing with sftp.
sftp ・ ・ ・ Secure File Transfer Protocol
sftp -i xx.pem username@hostname Example) ssh -i mydocker.pem ubuntu@ec2 ・ ・ ・ .amazonaws.com
・ Put local / path [remote / path] put temp_folder/myimage.tar /home/ubuntu Send local files to remote server (EC2)
・ Get local / path [remote / path] Fetch files from a remote server (EC2).
Access AWS with ssh and restore the image with docker load. · Ssh -i xx.pem username @ hostname -Docker load <filename.tar -Make it a container with docker run.
Example) docker load < myimage.tar
-Access with sftp and transfer the docker file. sftp -i xxx.pem ubuntu@[hostname] put local/path [remote/path]
・ Access with ssh, build and create a container ssh -i xxx.pem ubuntu@[hostname] (Create a new folder, create a build context and put the Dockerfile there) docker build .
This article is a transcript of udemy's docker course (https://www.udemy.com/share/103aTRAEMfeVhaTXoB/) by Kame-san (https://twitter.com/usdatascientist?s=21).
Kame-san's blog (https://datawokagaku.com/docker_lecture/)
Recommended Posts