ros2_docker_template/docker-compose.yaml

30 lines
1.7 KiB
YAML
Raw Permalink Normal View History

2023-08-24 10:23:28 +00:00
version: "3.9"
services: # in docker compose, service are definitions of your docker containers
2023-08-24 10:41:03 +00:00
2023-10-23 09:44:04 +00:00
hello-world: # for this example I am using a very simple docker build for reference: hello-world (builds very fast)
2023-10-23 09:28:37 +00:00
image: ghcr.io/bjoernellens1/ros2_docker_template/hello-world # hello-world image. No prefix means it defaults the image registry to dockerhub
2023-08-24 10:41:03 +00:00
build:
context: .
2023-10-23 09:44:04 +00:00
dockerfile: docker/hello-world.Dockerfile # the Dockerfile speciefies the steps taken in the build process.
2023-10-23 09:28:37 +00:00
tags:
- ghcr.io/bjoernellens1/ros2_docker_template/hello-world
2023-10-23 10:26:07 +00:00
target: hello-world # here you can explicitly specify the build target in the Dockerfile if you want only a specific build step for this service.
2023-10-23 09:44:04 +00:00
2023-10-23 10:24:41 +00:00
my_example: # this already represents a more complex ros2 build process.
2023-10-23 09:44:04 +00:00
image: ghcr.io/bjoernellens1/ros2_docker_template/my_example # hello-world image. No prefix means it defaults the image registry to dockerhub
build:
context: .
dockerfile: docker/my_example.Dockerfile # the Dockerfile speciefies the steps taken in the build process.
tags:
- ghcr.io/bjoernellens1/ros2_docker_template/my_example
2023-10-23 10:22:52 +00:00
environment:
# Allows graphical programs in the container.
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- NVIDIA_DRIVER_CAPABILITIES=all # For Nvidia hardware acceleration (CUDA, ...). This might additionally need some extra tools installed (Nvidia Container Toolkit?)
volumes:
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
2023-10-23 12:51:46 +00:00
network_mode: host # host networking makes life easier