Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docker compose file #47

Open
wants to merge 9 commits into
base: erf_demo
Choose a base branch
from
Open

Update docker compose file #47

wants to merge 9 commits into from

Conversation

nikhil-sethi
Copy link

@nikhil-sethi nikhil-sethi commented Feb 20, 2025

A build dockerfile is added to build the scancontrol package, save as an image and run the node as a service

To test, run docker compose up in the .docker directory

@nikhil-sethi nikhil-sethi changed the title Update compose file with a build dockerfile as well Update compose file with a build dockerfile Feb 20, 2025
@nikhil-sethi nikhil-sethi changed the title Update compose file with a build dockerfile Update compose Feb 20, 2025
@nikhil-sethi nikhil-sethi changed the title Update compose Update docker compose file Feb 20, 2025
@katettudelft
Copy link

To test, run docker compose up in the root directory

Running docker compose up in the repo root, I get the following error:

[katet][🌍 kate-mint]scancontrol [ compose_update]
❯ docker compose up 
no configuration file provided: not found
exit status 1

I don't see a top-level docker-compose.yaml in the repo root. Is it in /.docker/ by mistake?

@katettudelft
Copy link

Running docker compose up in the .docker directory gives me the following warning:

WARN[0000] The "PUID" variable is not set. Defaulting to a blank string. 
WARN[0000] The "PGID" variable is not set. Defaulting to a blank string. 
WARN[0000] The "PUID" variable is not set. Defaulting to a blank string. 
WARN[0000] The "PGID" variable is not set. Defaulting to a blank string.

A default value should be set in the compose file or the .env file if possible.

It does attempt to pull from the registry before building, but I don't think you've pushed it there yet. Is that correct?

@nikhil-sethi
Copy link
Author

It does attempt to pull from the registry before building, but I don't think you've pushed it there yet. Is that correct?

It's already there

@nikhil-sethi
Copy link
Author

I don't see a top-level docker-compose.yaml in the repo root. Is it in /.docker/ by mistake?

Updated PR description

@katettudelft
Copy link

katettudelft commented Feb 20, 2025

I should also add, after running compose up (and I've tested this both with and without the explicit --build flag), I'm left with two containers:

  • scancontrol-build (running)
  • scancontrol-service (stopped)

It seems like build never stops, my terminal seems stuck on this point:

[+] Running 3/4
 ✔ scancontrol-build              Built    0.0s 
 ✔ Network scancontrol_default    Created  0.0s 
 ⠴ Container scancontrol-build    Waiting  1297.9s 
 ✔ Container scancontrol-service  Created  0.0s

Having run it again, it has completed this time, leaving me with two stopped containers. What's the expected outcome? I had assumed it should be just one running container.

@katettudelft
Copy link

katettudelft commented Feb 20, 2025

It's already there

That's scancontrol:humble-base, which was last pushed on 2024-11-22. Are you sure that's the one?

The specific error I get is cut off, but starts with:

 ✘ scancontrol-service Error pull access denied for scancontrol, repository does not exist or may require 'docker login': denied: re... 

I've checked, I'm authenticated with the registry and can pull other images. I think perhaps the tag is wrong.

Copy link

@katettudelft katettudelft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to ask you a bit more about this on Monday, especially the build problems I'm seeing, but I'm trying to keep this to a light touch for now.

@@ -0,0 +1,29 @@
FROM registry.tudelft.nl/samxl/scancontrol:humble-base AS dev

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you're not using the original Dockerfile at all now? I thought you needed it for the drivers, aravis etc.

Copy link
Author

@nikhil-sethi nikhil-sethi Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is based on your preference to move towards a registry-based setup. The used image has all the drivers and the ros user as well.

IMO using our own organization registry in this repository is not a good idea and a building from scratch like in commit b23e76b would be better. Let me know what you think

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay. I didn't think we had a registry version of that image from our earlier conversation.

IMO using our own organization registry in this repository is not a good idea and a building from scratch like in commit b23e76b would be better

Since this is a public repo, rather than one of our internal ones, I agree entirely.

@nikhil-sethi
Copy link
Author

nikhil-sethi commented Feb 21, 2025

Built and ran after cleaning full docker install with docker system prune -a. Expected result:

nikhil@ubuntu:~/scancontrol/.docker$ docker compose up
[+] Running 2/2
 ! scancontrol-build Warning pull access denied for scancontrol, repository does not exist or may require 'docker login': denied: requested ...                            1.1s 
 ✘ scancontrol-service Error pull access denied for scancontrol, repository does not exist or may require 'docker login': denied: requested ...                            1.1s 
[+] Building 145.5s (15/15) FINISHED                                                                                                                                                         docker:default
 => [scancontrol-build internal] load build definition from build.Dockerfile                                                                                                                           0.0s
 => => transferring dockerfile: 899B                                                                                                                                                                   0.0s
 => [scancontrol-build internal] load metadata for registry.tudelft.nl/samxl/scancontrol:humble-base                                                                                                   0.2s
 => [scancontrol-build auth] samxl/scancontrol:pull token for registry.tudelft.nl                                                                                                                      0.0s
 => [scancontrol-build internal] load .dockerignore                                                                                                                                                    0.0s
 => => transferring context: 2B                                                                                                                                                                        0.0s
 => [scancontrol-build 1/8] FROM registry.tudelft.nl/samxl/scancontrol:humble-base@sha256:9f7730177439eb1e1d130b18b4f0f1c462567cae09317952429fcc9e4ad562fb                                            23.2s
 => => resolve registry.tudelft.nl/samxl/scancontrol:humble-base@sha256:9f7730177439eb1e1d130b18b4f0f1c462567cae09317952429fcc9e4ad562fb                                                               0.0s
 => => sha256:7478e0ac0f23f94b2f27848fbcdf804a670fbf8d4bab26df842d40a10cd33059 30.44MB / 30.44MB                                                                                                       3.3s
 => => sha256:9f7730177439eb1e1d130b18b4f0f1c462567cae09317952429fcc9e4ad562fb 3.06kB / 3.06kB                                                                                                         0.0s
 => => sha256:64c1e367d2c4dd5ee27bf7de101f8a5375cd32e0c78aaf62c8575c0e6b6b6d85 3.62MB / 3.62MB                                                                                                         0.8s
 => => sha256:5e134650a58527f750ae8240053485a2f137352ecf756235b1e1e6fdb2e58bd5 1.21MB / 1.21MB                                                                                                         0.4s
 => => sha256:1a120236c94d2f3d4924a01643ced635af55b3f533c7670cb9839091ae75286e 7.87kB / 7.87kB                                                                                                         0.0s
 => => sha256:41d91075c9ed31da02a9b4c33814db9286e4b1b259d48c139ab0c58bb41ea233 106.53MB / 106.53MB                                                                                                    14.8s
 => => sha256:e6852c2b80f647da68213c7078cdb71485445219e260e3465e6f38a0bb1ad627 272B / 272B                                                                                                             0.4s
 => => sha256:b33f588ed24bdf5fad71de96bbb5b7fc275fda37756cef0ed01956e6f35ebb4a 2.00kB / 2.00kB                                                                                                         0.4s
 => => sha256:a863eb46d7bd75292ab0d348f61c94a87a3bbc4b8f9e85de0b64e48d58b405c0 88.42MB / 88.42MB                                                                                                      12.7s
 => => sha256:6410a8272a83deb81f823b1cb3bf041f95c7d711601610c50de02837a1fab738 196B / 196B                                                                                                             0.8s
 => => extracting sha256:7478e0ac0f23f94b2f27848fbcdf804a670fbf8d4bab26df842d40a10cd33059                                                                                                              0.5s
 => => sha256:1ff08693425edbca91dac49ca47f5fc1e05dd11e2840dd02e9406afc2055ab96 414.64kB / 414.64kB                                                                                                     3.4s
 => => sha256:ea61bef0ad5b98451682b2b28d864a33e7ba8bde7ef5f2df09c0be0d78115f5f 25.01MB / 25.01MB                                                                                                       6.5s
 => => extracting sha256:5e134650a58527f750ae8240053485a2f137352ecf756235b1e1e6fdb2e58bd5                                                                                                              0.2s
 => => extracting sha256:64c1e367d2c4dd5ee27bf7de101f8a5375cd32e0c78aaf62c8575c0e6b6b6d85                                                                                                              0.0s
 => => extracting sha256:b33f588ed24bdf5fad71de96bbb5b7fc275fda37756cef0ed01956e6f35ebb4a                                                                                                              0.0s
 => => extracting sha256:e6852c2b80f647da68213c7078cdb71485445219e260e3465e6f38a0bb1ad627                                                                                                              0.0s
 => => sha256:3b590f2d659b06f61ff68758545acc73d484e3ab70cec997a658b79f67184bed 1.33MB / 1.33MB                                                                                                         6.7s
 => => sha256:8186b5322dab315b9ed9e4f586a2d1af0fb8dba8b1bc81b6e29139891994e6ec 10.81MB / 10.81MB                                                                                                       8.2s
 => => sha256:dca0aaa22255fd4c434f78eabab009c6cf1ab66c73cb979b3690436e739233d5 114.60MB / 114.60MB                                                                                                    17.5s
 => => extracting sha256:41d91075c9ed31da02a9b4c33814db9286e4b1b259d48c139ab0c58bb41ea233                                                                                                              3.8s
 => => extracting sha256:6410a8272a83deb81f823b1cb3bf041f95c7d711601610c50de02837a1fab738                                                                                                              0.0s
 => => extracting sha256:a863eb46d7bd75292ab0d348f61c94a87a3bbc4b8f9e85de0b64e48d58b405c0                                                                                                              1.1s
 => => extracting sha256:1ff08693425edbca91dac49ca47f5fc1e05dd11e2840dd02e9406afc2055ab96                                                                                                              0.0s
 => => extracting sha256:ea61bef0ad5b98451682b2b28d864a33e7ba8bde7ef5f2df09c0be0d78115f5f                                                                                                              0.4s
 => => extracting sha256:3b590f2d659b06f61ff68758545acc73d484e3ab70cec997a658b79f67184bed                                                                                                              0.0s
 => => extracting sha256:8186b5322dab315b9ed9e4f586a2d1af0fb8dba8b1bc81b6e29139891994e6ec                                                                                                              0.2s
 => => extracting sha256:dca0aaa22255fd4c434f78eabab009c6cf1ab66c73cb979b3690436e739233d5                                                                                                              2.5s
 => [scancontrol-build internal] load build context                                                                                                                                                    0.1s
 => => transferring context: 6.12MB                                                                                                                                                                    0.1s
 => [scancontrol-build 2/8] RUN sudo apt-get update   && sudo apt-get install --no-install-recommends -y     build-essential     git     python3-colcon-common-extensions     python3-colcon-mixin    11.1s
 => [scancontrol-build 3/8] WORKDIR /workspaces/lls_ws                                                                                                                                                 0.0s
 => [scancontrol-build 4/8] COPY . /workspaces/lls_ws/src/scancontrol                                                                                                                                  0.0s
 => [scancontrol-build 5/8] RUN sudo chown -R ${USERNAME}:${USERNAME} /workspaces/lls_ws                                                                                                               0.2s
 => [scancontrol-build 6/8] RUN sudo -E rosdep init   && rosdep update   && sudo apt-get update                                                                                                        9.9s
 => [scancontrol-build 7/8] RUN rosdep install --from-paths src --ignore-src -r -y     && sudo rm -rf /var/lib/apt/lists/*                                                                            75.3s
 => [scancontrol-build 8/8] RUN source /opt/ros/humble/setup.bash && colcon build                                                                                                                     18.3s 
 => [scancontrol-build] exporting to image                                                                                                                                                             7.1s 
 => => exporting layers                                                                                                                                                                                7.1s 
 => => writing image sha256:0682aafe5646cfd36b0b5b5dec29c66bdde1418a4fc6395f1db94ad25e640057                                                                                                           0.0s 
 => => naming to docker.io/library/scancontrol:build                                                                                                                                                   0.0s 
 => [scancontrol-build] resolving provenance for metadata file                                                                                                                                         0.0s 
[+] Running 4/4                                                                                                                                                                                             
 ✔ scancontrol-build              Built                                                                                                                                                                0.0s 
 ✔ Network scancontrol_default    Created                                                                                                                                                              0.1s 
 ✔ Container scancontrol-build    Created                                                                                                                                                              0.0s 
 ✔ Container scancontrol-service  Created                                                                                                                                                              0.0s 
Attaching to scancontrol-build, scancontrol-service
scancontrol-build exited with code 0
scancontrol-service  | [WARN] [1740130857.706295260] [scancontrol_driver_node]: There is no scanCONTROL device connected. Exiting...
scancontrol-service  | [FATAL] [1740130857.708029666] [scancontrol_driver]: ScanControlDriver: Initialization failed.
scancontrol-service exited with code 0

This is on my Dev PC. When running on the NUC, the laser driver succeeds and the laser service keeps running (because the laser is connected).

The ✘ scancontrol-service Error pull access denied error at the top is not a fatal related to the repository. It probably tells you that the scancontrol-service depends on scancontrol-build which needs to complete first (the image does not exist yet, and needs to be built). On later runs, this does not happen.

I would recommend to check your docker install, build cache and any other orphan images. My docker versions:

Client: Docker Engine - Community
 Version:           27.5.0
 API version:       1.47
 Go version:        go1.22.10
 Git commit:        a187fa5
 Built:             Mon Jan 13 15:24:49 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.5.0
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.22.10
  Git commit:       38b84dc
  Built:            Mon Jan 13 15:24:49 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.25
  GitCommit:        bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc:
  Version:          1.2.4
  GitCommit:        v1.2.4-0-g6c52b3f
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

@nikhil-sethi nikhil-sethi changed the base branch from single_dockerfile_with_stages to erf_demo February 21, 2025 10:03
@nikhil-sethi
Copy link
Author

nikhil-sethi commented Feb 21, 2025

Changed the base branch to erf_demo so that an existing MR #45 doesnt get out of scope.

This branch will be the working branch for the demo. Also fixed up author info. Some commits were from the NUC

- shorter build but depends on registry
- It's already implicit in the used dockerfile
- otherwise it creates a default network
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants