This is how my docker file looks like
version: "3"
services:
controller:
build: ./cd_controller
image: cd_controller:latest
env_file: $PWD/robot-configurations/.env
cap_add:
- ALL
links:
- test_fixture
volumes:
- dependencypackages:/root/dependency-packages
- robotconfigurations:/root/robot-configurations
container_name: controller_g5
test_fixture:
image: docker-standard-all.ur-update.dk/ur/pytest-ur:0.7.1
volumes:
- pytestfixture:/workspace
- controllertests:/workspace/controller-tests
entrypoint: /workspace/entrypoint.sh
container_name: test_fixture
stdin_open: true # docker run -i
tty: true # docker run -t
volumes:
robotconfigurations:
driver_opts:
type: none
device: $PWD/robot-configurations
o: bind
...
Basically it has two two services/containers controller&test_fixture. controller has source code running and test_fixture contains all the test_cases. test_fixture needs to talk to controller through a socket. Since docker-compose creates a network among its containers, in my py-test cases I am simply using
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("controller_g5", 30001)) # controller_g5 is name of the controller container
So far every thing look fine. But I realized that I have multiple versions/features of the source code. So I would like to create a multiple instances of a same thing each have their own network. Does naming the container blocks the container creation with same name in different network ? Also I am not sure how to spin up one more network with similar container on the same host machine. I came across Multiple isolated environments on a single host But couldn't manage to get a sample example.
Any help is greatly appreciated.