agent: |
hxzkCrMMd9rBWB89v0UqEnsure the container port is exposed
Ensure the container port is exposed
There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
First check if the container port is exposed
inputs
outputs
service = "nginx"
op = _exei(instance_id, "cd /home/ubuntu/dagknows_src/app_docker_compose_build_deploy")
# First get the container associated with service
cmd = f"sudo docker-compose -f {docker_compose_file} ps -q {service}"
op = _exei(instance_id, cmd)
container_id = op.split('\n')[-2].strip()
# Now inspect the container
cmd = f"sudo docker inspect {container_id}"
op1 = _exe(instance_id, cmd)
import json
jsn = json.loads(op1)
#print(json.dumps(jsn, indent=4))
port_str = f"{port}/tcp"
exposed_ports = list(jsn[0]['Config']['ExposedPorts'].keys())
print(exposed_ports)
if port_str in exposed_ports:
port_is_exposed = True
msg = f"Port : {port_str} is exposed by the service {service}"
msg_type = "SUCCESS"
else:
port_is_exposed = False
msg = f"Port : {port_str} is NOT exposed by the service {service}"
msg_type = "ERROR"
context.log(msg_type, msg)
task_title = context.task_title
context.job_context[task_title] = {"msg" : msg, "msg_type" : msg_type}
context.skip_sub_tasks = port_is_exposed
copied
- 1Q5XUo4q5IOpSSACjm3FDExpose the container port
1
There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.inputsoutputs# Here we need to edit the docker-compose file and expose the container portcopied1