0

Im currently experimenting with UDP sockets in zig. The System consists of a test sender and a test reciever, both of which work fine and build fine on the host and in the containers, but somehow one of the twi generated executables is not copied into it's container and thus exits immediately.

dev_gs-exchange-1  | exec /runtime: no such file or directory
dev_gs-test-1      | Reciever Started...
dev_gs-exchange-1 exited with code 1

The Dockerfiles are still very barebones so bear with me...
docker-compose.yaml:

version: "3.8"
services:
  exchange:
    build:
      context: images/Exchange
      target: exchange
    networks:
      - internal_net

  test:
    build:
      context: images/Exchange
      target: test
    networks:
      - internal_net

networks:
  internal_net:
    driver: bridge

images/Exchange/Dockerfile:

FROM euantorano/zig:0.10.1 as zigbase

FROM zigbase as exchangebuild
COPY include /include
COPY src /src
COPY build.zig /build.zig
RUN ["zig", "build", "-fstage1"]

FROM debian:bullseye-slim AS test
COPY --from=exchangebuild /zig-out/bin/test /test
ENTRYPOINT [ "/test" ]

FROM debian:bullseye-slim AS exchange
COPY --from=exchangebuild /zig-out/bin/exchange /runtime
ENTRYPOINT [ "/runtime" ]

in images/Exchange after calling zig build -fstage1:

_❯ ll                                                                                                                                                                             (base)  ❮    
 .
├──  build.zig
├──  Dockerfile
├──  include
│   └──  udp.zig
├──  src
│   ├──  exchange.zig
│   └──  test.zig
├──  zig-cache
│   └── ... [ommitted for your convenience]
└──  zig-out
    └──  bin
        ├──  exchange
        └──  test

the System in running on:

_❯ neofetch                                                                                                                                                                       (base)  ❮    
             `..---+/---..`                tl044cn@NeonSpirit 
         `---.``   ``   `.---.`            ------------------ 
      .--.`        ``        `-:-.         OS: KDE neon 5.27 x86_64 
    `:/:     `.----//----.`     :/-        Host: XMG CORE (TGL/M21) Standard 
   .:.    `---`          `--.`    .:`      Kernel: 5.19.0-41-generic 
  .:`   `--`                .:-    `:.     Uptime: 1 hour, 25 mins 
 `/    `:.      `.-::-.`      -:`   `/`    Packages: 3529 (dpkg), 48 (flatpak), 8 (snap) 
 /.    /.     `:++++++++:`     .:    .:    Shell: fish 3.5.1 
`/    .:     `+++++++++++/      /`   `+`   Resolution: 2560x1440, 2560x1440 
/+`   --     .++++++++++++`     :.   .+:   DE: Plasma 
`/    .:     `+++++++++++/      /`   `+`   WM: KWin 
 /`    /.     `:++++++++:`     .:    .:    WM Theme: LyraX-dark 
 ./    `:.      `.:::-.`      -:`   `/`    Theme: [Plasma], Breeze [GTK3] 
  .:`   `--`                .:-    `:.     Icons: Lyra-blue-dark [Plasma], Lyra-blue-dark [GTK2/3] 
   .:.    `---`          `--.`    .:`      Terminal: konsole 
    `:/:     `.----//----.`     :/-        Terminal Font: CaskaydiaCove Nerd Font Mono 15 
      .-:.`        ``        `-:-.         CPU: 11th Gen Intel i7-11800H (16) @ 4.600GHz 
         `---.``   ``   `.---.`            GPU: Intel TigerLake-H GT1 [UHD Graphics] 
             `..---+/---..`                GPU: NVIDIA GeForce RTX 3060 Mobile / Max-Q 
                                           Memory: 4964MiB / 64052MiB

Ive been trying to output the contents of the containers before, and they both showed the executables in the root directory of the containers as it should be. I expected the 2 Containers to just fire up the executables and be done with it. The Test container works fine. just Exchange doesn't

I also updated docker and docker-compose to the latest versions as i was still running an old version.

TL044CN
  • 9
  • 1
  • What is the file that returns the not found error? Is it a script (for what interpreter), or a binary, statically linked (ldd), compiled for what platform? – BMitch Apr 29 '23 at 10:27
  • the not found error is returned by a compiled zig binary, compiled in the build container which uses alpine as base image i think. The test executable was made the same way but it works without problem. Both are compiled with the standard options for the uig 0.10.1 compiler – TL044CN May 01 '23 at 08:07

0 Answers0