VIRTUAL MACHNE HOSTED ON AWS EC2 INSTANCE , RUNNING DOCKER FROM EC2 , UNABLE TO OPEN THE web address (172.17.0.2) from MacOs

VIRTUAL MACHNE HOSTED ON AWS EC2 INSTANCE , RUNNING DOCKER FROM EC2 , UNABLE TO OPEN THE web address OF JENKINS (172.17.0.2) from MacOs

Hi @gowtham.pagidela

First, let’s try to establish what you’re trying to do.

  • You have an EC2 instance, running docker, and you’re trying to run Jenkins as a container
  • You are trying to connect to that Jenkins from your own Mac

Correct?

Assuming this is the case, there’s a few things

  • 172.17.0.0 is the internal docker network. This is not directly visible to the outside world.
  • You address the Jenkins instance by connecting to the public IP of the instance that is running the container.

Here is a step by step guide. Note that this is an insecure solution for testing only and not suitable for production use

  1. Launch EC2 instance, ensuring it has a public IP assigned
  2. Modify its security group so that inbound access to ports 22 and 80 are only from your computer’s IP (find this by going to http://checkip.amazonaws.com)
  3. SSH onto instance, install and start docker
  4. Run Jenkins
docker run -d -p 80:8080 jenkins:2.60.3

This will expose Jenkins (which runs inside the container on port 8080) from the EC2 instance on port 80. While still logged into the EC2 instance, you can verify it is running by doing

curl http://localhost

Finally, note the public IP of the ec2 instance (for example 50.17.106.8)

Connect to Jenkins from your Mac’s browser

http://50.17.106.8