BIPS/Examples/Docker Containers: Difference between revisions
mNo edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
{{BIPS/Head|previous=Examples/C++ to Python|next=Examples/GStreamer to Python}} | {{BIPS/Head|previous=Examples/C++ to Python|next=Examples/GStreamer to Python}} | ||
</noinclude> | </noinclude> | ||
<seo title="BIPS Examples - Docker Containers | RidgeRun" titlemode="replace" metakeywords="GStreamer, NVIDIA, Jetson, TX1, TX2, Jetson AGX Xavier, Xavier, AI, Deep Learning, Machine Learning, Jetson TX1, Jetson TX2, Jetson Xavier, NVIDIA Jetson Xavier, NVIDIA Jetson Orin, Jetson Orin, Orin, NVIDIA Orin, NVIDIA Jetson AGX Orin, Jetson AGX Orin, Assembly Line, Assembly Line Activity, activity recognition, machine learning activity recognition, Exploratory Data Analysis, EDA" description="This RidgeRun wiki page provides more information on the RidgeRun Buffer Interprocess Sharing (BIPS) examples of docker containers."></seo> | |||
== Introduction == | == Introduction == |
Latest revision as of 21:05, 27 August 2024
Buffer Interprocess Sharing | |
---|---|
BIPS Basics | |
|
|
Getting Started | |
|
|
User Manual | |
|
|
Examples | |
|
|
Performance | |
|
|
Contact Us | |
|
Introduction
The Docker examples take into account two possible cases:
- One-to-one communication
Within the source code, there are Dockerfiles, and Docker Compose files that illustrate how BIPS is capable of running on containers. Please, consider the following file tree:
src ├── examples └── docker ├── bips.env ├── Dockerfile └── one-to-one.docker-compose.yml
Make sure to have docker and docker-compose installed in your system. You can follow these guides:
- [Docker](https://docs.docker.com/engine/install/ubuntu/)
- [Docker Compose](https://docs.docker.com/compose/install/linux/#install-using-the-repository)
Example options
The Docker Compose file is parametric through environment variables. You can modify the parameters of the execution in the:
- bips.env
or provide an environment file through the docker-compose
file using --env-file
The options are:
# Buffer pool size in buffers BUFFER_POOL_SIZE=10 # Channel name - how the containers are communicated. You can leave it like that CHANNEL=/docker_test # Buffer size to transmit (4K image in RGBA) BUFFER_SIZE=33177600 # Number of data to process (minimum 8 bytes, maximum buffer size). It increases the processing time. PROCESS_SIZE=64 # Timeout in case of interruption (in seconds) TIMEOUT=15 # Number of transmissions NUM_ITERATIONS=1000
Running the examples
One-to-one example
In the root of the repo, execute:
COMPOSE_FILE=one-to-one.docker-compose.yml docker-compose -f src/examples/docker/${COMPOSE_FILE} up --build
It will create a couple of containers: one for the producer and another for the consumer.
One-to-many example
You can use the replicas property in Docker Compose. Please, modify src/examples/docker/one-to-one.docker-compose.yml
as:
version: "3.9" services: # Producer service example: build an image compiling the examples # and raising the producer example producer: build: # The docker compose command must be invoked in the root directory # to get the source code dockerfile: src/examples/docker/Dockerfile context: ../../.. env_file: - ./bips.env environment: # Application to launch - APP=producer volumes: # The shared memory must be shared - /dev/shm:/dev/shm:rw # Consumer service example: build an image compiling the examples # and raising the consumer example consumer: build: # The docker compose command must be invoked in the root directory # to get the source code dockerfile: src/examples/docker/Dockerfile context: ../../.. deploy: mode: replicated replicas: 2 env_file: - ./bips.env environment: # Application to launch - APP=consumer volumes: # The shared memory must be shared - /dev/shm:/dev/shm:rw depends_on: # The consumer cannot start without a producer producer: condition: service_started
Save it as src/examples/docker/one-to-many.docker-compose.yml
. This illustrates how you can introduce new replicas according to your needs. Afterwards, run
COMPOSE_FILE=one-to-many.docker-compose.yml docker-compose -f src/examples/docker/${COMPOSE_FILE} up --build