Giter Club home page Giter Club logo

Comments (2)

mirkoperillo avatar mirkoperillo commented on June 9, 2024 1

More tests about the problem.

I think I have isolated the problem, it is something about the image platform used by docker-compose.

To test this I have created a Dockerfile.local without --platform=$BUILDPLATFORM and GOARCH=$TARGETARCH part, so something like this

FROM golang:1.19.1-bullseye as stage

ADD . /src
WORKDIR /src

RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags "-s -w" "github.com/ortuman/jackal/cmd/jackal"
RUN CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags "-s -w" "github.com/ortuman/jackal/cmd/jackalctl"
RUN chmod +x jackal jackalctl

FROM debian:stable-slim

RUN apt-get update && apt-get install -y ca-certificates
RUN update-ca-certificates

WORKDIR /jackal

COPY --from=stage /src/jackal /jackal
COPY --from=stage /src/jackalctl /jackal

EXPOSE 5222

ENV PATH $PATH:/jackal

CMD ["./jackal"]

and have used this Dockerfile.local directly into docker-compose, so with a jackal service definition like this

 jackal:
    build:
      context: ..
      dockerfile: dockerfiles/Dockerfile.local
    ports:
      - 5222:5222
      - 15280:15280
    environment:
      - JACKAL_LOG_STANZAS=on
    depends_on:
      - etcd
      - pgsql
    working_dir: /jackal
    volumes:
      - ../scripts/wait-for-it.sh:/jackal/wait-for-it.sh
      - ../config/docker-compose.config.yaml:/jackal/config.yaml
    command:
      - ./wait-for-it.sh
      - pgsql:5432
      - --
      - ./wait-for-it.sh
      - etcd:2379
      - --
      - ./jackal

then I have executed the command
sudo docker-compose -f dockerfiles/docker-compose.yml up --force-recreate

and wait-for-it.sh script works as expected

The output:

jackal_1  | wait-for-it.sh: waiting 15 seconds for pgsql:5432
jackal_1  | wait-for-it.sh: pgsql:5432 is available after 0 seconds
jackal_1  | wait-for-it.sh: waiting 15 seconds for etcd:2379
jackal_1  | wait-for-it.sh: etcd:2379 is available after 0 seconds
jackal_1  | level=info ts=2022-10-28T16:55:13.685507956Z caller=jackal.go:190 msg="jackal is starting...
...
...

from jackal.

mirkoperillo avatar mirkoperillo commented on June 9, 2024

I have tried to understand better the problem, more details about:

  • If I try to change command in docker-compose.yml to run a simple command like echo:
command:
     - echo
     - "Hi Jackal!"

I've got the same error exec format error

  • If I try to run directly jackal output is ok
command:
     - ./jackal

The problem seems specific of the jackal docker image. I've tried to run wait-for-it using directly the debian:stable-slim image (the one used by jackal image) and wait-for-it script works correctly

jackal:
    image: debian:stable-slim
    depends_on:
      - etcd
      - pgsql
    volumes:
      - ../scripts:/scripts
    command:
      - /scripts/wait-for-it.sh
      - pgsql:5432
      - --
      - echo
      - "Hi Jackal!"

Output

jackal_1  | wait-for-it.sh: waiting 15 seconds for pgsql:5432
jackal_1  | wait-for-it.sh: pgsql:5432 is available after 0 seconds
jackal_1  | Hi Jackal!
dockerfiles_jackal_1 exited with code 0

from jackal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.