ros2_docker_template/README.md

40 lines
1.4 KiB
Markdown
Raw Normal View History

2023-08-24 10:23:28 +00:00
# my_ros2_docker_image
Following this you will be able to do multiplatform builds with docker buildx.
For the build with docker buildx you will need binfmt dependencies for arm64 architecture, as we are doing a multiplatform build (Works on PCs as well as Jetson Nano, Raspberry Pi, Apple Silicon Devices).
## What you will want to change:
### my.repos and my_extended.repos:
These are yaml files containing the repositories you may want to include into your final ros2 workspace.
For a multi-stage build for instance, I define my base image repositories in "my.repos" and the extended image repositories in "my_extended.repos"
## To build the image for example_service (and push it to your container registry):
2023-10-23 08:30:09 +00:00
```
2023-10-23 08:29:16 +00:00
docker buildx bake example_service --load # to load into local container registry
2023-10-23 08:30:39 +00:00
```
```
2023-10-23 08:29:16 +00:00
docker buildx bake example_service --push # to push into specified remote container registry
2023-10-23 08:30:09 +00:00
```
2023-08-24 10:23:28 +00:00
## To run example_service:
2023-10-23 08:28:10 +00:00
### Run example_service in background
2023-10-23 08:30:09 +00:00
```
2023-08-24 10:23:28 +00:00
docker compose up -d example_service
2023-10-23 08:30:09 +00:00
```
2023-10-23 08:28:10 +00:00
### Run example_service in foreground
2023-10-23 08:30:09 +00:00
```
2023-10-23 08:28:10 +00:00
docker compose up example_service
2023-10-23 08:30:09 +00:00
```
2023-10-23 08:28:10 +00:00
### Execute shell inside example_service
#### If container is stopped
2023-10-23 08:30:09 +00:00
```
2023-10-23 08:28:10 +00:00
docker compose run example_service bash
2023-10-23 08:30:09 +00:00
```
2023-10-23 08:28:10 +00:00
#### If container is already running
2023-10-23 08:30:09 +00:00
```
2023-10-23 08:28:10 +00:00
docker compose exec example_service bash
2023-10-23 08:30:09 +00:00
```
2023-10-23 08:28:10 +00:00
### Execute example_program inside example_service
2023-10-23 08:30:09 +00:00
```
2023-10-23 08:28:10 +00:00
docker compose run example_service example_program
2023-10-23 08:30:09 +00:00
```