2

We have Sitecore-xp0 setup done on docker from the developer machine(D1). Which can be accessible from the XM hostname and also by XM Container IP address from the D1 machine. We are able to get container id by command as docker inspect container-id

Now trying to access the same instance from another Developer machine D2,
for that given docker image path access and we are on the same network using VPN connection.

But no luck - Are we missing any steps, please help/advise? OR any easiest approach to access docker XM container from another developer machine.

1
  • Docker has different network types: bridge, host, none, overlay, macvlan. Default is "Brigde", which some kind isolates your containers network. You can try to use "Host" network.
    – Anton
    Jan 19, 2022 at 16:53

2 Answers 2

1

You can use docker-compose to specify the ports you want to expose at the host machine level. As long as there are no conflicts, you can use the IP or hostname of the D1 machine from the D2 machine via the port specified.

    ports:
      - 8000:80

The first port listed is the host machine port, the second is the docker container port.

0

Check the running containers ID and port numbers by running the docker container ls command

enter image description here

In the above example, you can see sitecore-xp0-cm container image is running on port 80, now you can map port 80 of the container to the host machine port. Make sure the host machine port is not in already use.

In your Sitecore docker set-up folder, open the docker-compose.yml file in the notepad editor. Check the CM container configuration section and add a ports node like the below screenshot. The first port is the localhost port and the second port is the container port.

cm:
    isolation: ${ISOLATION}
    image: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-cm:${SITECORE_VERSION}
    ports:
      - "8001:80"
    depends_on:
      id:
        condition: service_started
      xconnect:
        condition: service_started
[...]

enter image description here

Now once you'll run the containers, CM container is accessible via localhost:8001.

enter image description here

Any other machine on the same network can access port 8001 of the host machine, and they will be able to access the CM container.

You can find more details here: https://sitecorewithraman.wordpress.com/2023/03/26/access-sitecore-docker-container-from-another-machine-on-local-network/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.