About using docker.io/ansible/ansible:httptester

Hi

I’m trying to use docker.io/ansible/ansible:httptester.
When /services.sh is executed, following errors are prompted:

2018/03/27 13:39:46 [emerg] 43#43: bind() to 0.0.0.0:80 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
2018/03/27 13:39:46 [emerg] 43#43: bind() to 0.0.0.0:443 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address in use)
2018/03/27 13:39:46 [emerg] 43#43: bind() to 0.0.0.0:80 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
2018/03/27 13:39:46 [emerg] 43#43: bind() to 0.0.0.0:443 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address in use)
2018/03/27 13:39:46 [emerg] 43#43: bind() to 0.0.0.0:80 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
2018/03/27 13:39:46 [emerg] 43#43: bind() to 0.0.0.0:443 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address in use)
2018/03/27 13:39:46 [emerg] 43#43: bind() to 0.0.0.0:80 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
2018/03/27 13:39:46 [emerg] 43#43: bind() to 0.0.0.0:443 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address in use)
2018/03/27 13:39:46 [emerg] 43#43: bind() to 0.0.0.0:80 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use)
2018/03/27 13:39:46 [emerg] 43#43: bind() to 0.0.0.0:443 failed (98: Address in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address in use)
2018/03/27 13:39:46 [emerg] 43#43: still could not bind()
nginx: [emerg] still could not bind()

– Already verified that both ports 443 and 80 are NOT occupied by executing following commands:

  • sudo fuser -k 80/tcp
  • sudo fuser -k 443/tcp

Any Idea about this?

THX - Albert

When using the container that is on docker hub, there is no need to run services.sh. The “CMD” in the Dockerfile will run services.sh automatically.

The image exposes 80/443, but you also have to instruct docker to publish them. Such as -p 80:80 -p 443:443:

$ docker run --rm -d -p 80:80 -p 443:443 ansible/ansible:httptester

c1b5a01de4eff64832e7082d6441a6a1671aa195710db08f4accd692ffb1eae1

$ curl http://localhost:80/get
{
“args”: {},
“headers”: {
“Accept”: “/”,
“Connection”: “close”,
“Host”: “localhost”,
“User-Agent”: “curl/7.54.0”
},
“origin”: “172.17.0.1”,
“url”: “http://localhost/get
}

There is a little info about the image and building it at http://docs.ansible.com/ansible/devel/dev_guide/testing_httptester.html

Also: https://github.com/ansible/ansible/tree/devel/test/utils/docker/httptester

I’m not positive what you plan on using it for, but do note that it was purpose built with the intent of using it as a testing endpoint for us.