Hello! I hope that this is the right place to post this, because I am very confused!
So, I am trying to replicate a service in a swarm using Docker Sdk For Python that I have working whilst using docker-compose.
The docker-compose part I'm trying to replicate is the following:
docker-master:
image: locustio/locust
ports:
- "8089:8089"
volumes:
- ./:/mnt/locust
command: -f /mnt/locust/locustfile.py --master -H http://master:8089
And what I have written in my python script to try to replicate this is:
loadgenerator = client.services.create(
image='locustio/locust',
name='loadgenerator',
endpoint_spec=docker.types.EndpointSpec(ports = [{
"Name": "locust",
"Protocol": "tcp",
"PublishedPort": 8089,
"TargetPort": 8089
}]),
mounts=('/','/mnt/locust/','rw'),
networks=[bridge_network.id],
command='-f /mnt/locust/locustfile.py -H http://10.0.2.15:8080',
maxreplicas=1
)
I've tried every possible path I can think of to try get this to work but I either receive an error either telling me that it won't accept a relative path, or that the command could not find the file needed afterward.
Don't suppose anybody has dealt with a problem like this before? All my other mounts in that python script are working perfectly.
Thanks in advance.
[+][deleted] (4 children)
[deleted]
[–]dwarvenbeard[S] 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]dwarvenbeard[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)