skip to Main Content

Here is my Dockerfile:

FROM golang:1.17.5 as builder

WORKDIR /go/src/github.com/cnosdb/cnosdb

COPY . /go/src/github.com/cnosdb/cnosdb

RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go env -w GO111MODULE=on
RUN go install ./...

FROM debian:stretch
COPY --from=builder /go/bin/cnosdb /go/bin/cnosdb-cli /usr/bin/
COPY --from=builder /go/src/github.com/cnosdb/cnosdb/etc/cnosdb.sample.toml /etc/cnosdb/cnosdb.conf

EXPOSE 8086
VOLUME /var/lib/cnosdb

COPY docker/entrypoint.sh /entrypoint.sh
COPY docker/init-cnosdb.sh /init-cnosdb.sh
RUN chmod +x /entrypoint.sh /init-cnosdb.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["cnosdb"]

Here is my configuration of my jenkins:
enter image description here
But the image docker built didn’t have a name.
enter image description here

why?

2

Answers


  1. I haven’t used Jenkins for this, as I build from the command line. But are you expecting your name arg to show up in the REPOSITORY and TAG columns? If that is the case, docker has a docker tag command, like so:

    ~$ docker tag <image-id> repo/name:tag 
    

    When I build from the command line, I do it like this:

    ~$ docker build -t repo/name:0.1 .
    

    Then if I check images:

    ❯ docker image ls
    REPOSITORY                                                           TAG         IMAGE ID       CREATED        SIZE
    repo/name                                                            0.1      689459c139ef   2 days ago      187MB
    
    Login or Signup to reply.
  2. Adding to what @rtl9069 mentioned the docker build command can be ran as part of a pipeline. Please take a look at this article https://www.liatrio.com/blog/building-with-docker-using-jenkins-pipelines as it describes it with examples.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search