Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (12.7k points)
I have a Java socket application that requires a port number as a CLI argument. On my local machine I can run it via:

docker run -d -p 1111:1111 --name <name> --link <link> <foo>/<bar> 1111

The problem is that I haven't found a solution to pass the port number when using Ansible (I have a different task that pulls the image). Current task:

- name: Run server


          name: <name>

          image: <foo>/<bar>

          state: reloaded


              - "1111:1111"


              - "<link>"

Is there a way to pass the port as a CLI argument? Or is there a simple way to work around this? I've though about uploading a new image or using the command module but neither seem like right way to go.

1 Answer

0 votes
by (29.5k points)
There is no native support to pass arbitrary arguments in Ansible's Docker module.  Try using shell module

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.6k answers


108k users

Browse Categories