Created
February 28, 2024 00:52
-
-
Save sivaprasadreddy/42feb210a1e14214e86a2aa4039b2052 to your computer and use it in GitHub Desktop.
Remote Docker Host Setup on AWS EC2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create EC2 instance using Ubuntu | |
2. Connect to EC2 VM using ssh | |
3. Install Docker by following https://docs.docker.com/engine/install/ubuntu/ | |
4. Run post installation steps to run Docker as a non-privileged user https://docs.docker.com/engine/install/linux-postinstall/ | |
5. From local computer, copy your ssh publicKey content (i.e, ~/.ssh/id_rsa.pub or ~/.ssh/id_ed25519.pub) | |
6. In EC2 VM, add your public ssh public key to ~/.ssh/authorized_keys using echo 'ssh-rsa ....' >> ~/.ssh/authorized_keys | |
7. Now from local computer, you should be able to login using : `ssh ubuntu@EC2_PUBLIC_IP` | |
8. Set `DOCKER_HOST` env var as `export DOCKER_HOST=ssh://ubuntu@EC2_PUBLIC_IP` | |
9. Run docker info. It should connect to remote docker running in your EC2 EC2_PUBLIC_IP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment