#1679  Build Docker Image doesn't work anymore
Released
Andreas Wachter opened 5 months ago

I have a repository that automatically builds a container and I get the following error message since yesterday:

Failed to run command: docker buildx build --push -t buddyspencer/golang-just ., return code: 125
unknown flag: --push
See 'docker --help'.

Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Common Commands:
  run         Create and run a new container from an image
  exec        Execute a command in a running container
  ps          List containers
  build       Build an image from a Dockerfile
  pull        Download an image from a registry
  push        Upload an image to a registry
  images      List images
  login       Log in to a registry
  logout      Log out from a registry
  search      Search Docker Hub for images
  version     Show the Docker version information
  info        Display system-wide information

Management Commands:
  builder     Manage builds
  container   Manage containers
  context     Manage contexts
  image       Manage images
  manifest    Manage Docker image manifests and manifest lists
  network     Manage networks
  plugin      Manage plugins
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes

Swarm Commands:
...

I use the Build Docker Image template. Can you have a look at it?

Robin Shen commented 5 months ago

OneDev 9.3.1 switched to call buildx to build images which is much flexible and powerful.

Buildx ships with docker new version by default. For old version you will need to install it separately:

https://docs.docker.com/build/architecture/

Andreas Wachter commented 5 months ago

does that mean I need to upgrade my agents? because I use the 1dev/agent images on my nodes.

Robin Shen commented 5 months ago

Agent does not need to be upgraded (and can not be upgraded manually as it syncs with server automatically).

The build image step calls OS docker facility directly.

Andreas Wachter commented 5 months ago

ok, I'll see to it then. Thanks

Andreas Wachter commented 5 months ago

I am already on the latest docker version. But I found out that if I run the 1dev/agent container on my system and mount docker.sock into it, it doesn't work either.

docker run -ti -v /var/run/docker.sock:/var/run/docker.sock 1dev/agent bash 
Unable to find image '1dev/agent:latest' locally
latest: Pulling from 1dev/agent
5e8117c0bd28: Already exists 
b5e617f0425a: Pull complete 
ce5a045c6018: Pull complete 
ff273bcf844a: Pull complete 
74615a534607: Pull complete 
f833c80c5283: Pull complete 
4f4fb700ef54: Pull complete 
e94b55cb7dee: Pull complete 
Digest: sha256:bfd607bdf9b09c9371a098d300191fbcfaf621003b38781c07478213c8088ab5
Status: Downloaded newer image for 1dev/agent:latest
root@11c013abddf8:/agent/bin# docker buildx
docker: 'buildx' is not a docker command.
See 'docker --help'
Robin Shen commented 5 months ago

Please install it by running:

sudo apt-get install docker-buildx-plugin 
jbauer commented 5 months ago

@cooperspencer Take a look at my last comment in https://code.onedev.io/onedev/server/~issues/1523 maybe that helps.

Andreas Wachter commented 5 months ago

IMHO buildx should be installed in the official agent container and not me making a homebrewed version of the official one.

Andreas Wachter commented 5 months ago

I opened a pull request for it. https://code.onedev.io/onedev/server/~pulls/65

Robin Shen changed fields 5 months ago
Name Previous Value Current Value
Priority
Normal
Major
OneDev changed state to 'Closed' 5 months ago
Previous Value Current Value
Open
Closed
OneDev commented 5 months ago

State changed as code fixing the issue is committed (b6aa1a29)

Referenced from commit 5 months ago
OneDev changed state to 'Released' 5 months ago
Previous Value Current Value
Closed
Released
OneDev commented 5 months ago

State changed as build #4380 is successful

Robin Shen commented 5 months ago

I opened a pull request for it. https://code.onedev.io/onedev/server/~pulls/65

Thanks for submitting the fix. I did not realized you are running agent inside container.

Please upgrade to 9.3.2 (to incude buildx in server container as well), and also pull agent image to make things work.

Andreas Wachter commented 5 months ago

no worries, glad I could help

Andreas Mack commented 5 months ago

What's the best way to keep the agent container updated? Cron job to pull regularly? How about a notification if the agent container is too old?

Andreas Wachter commented 5 months ago

I usually use watchtower to keep my containers up to date. I run it in a cronjob.

Robin Shen commented 5 months ago

It rarely needs to be updated. In case it is necessary, the incompatiblity note when upgrade to a new version will mention it. Like in 9.3.2 (added laterly).

Andreas Mack commented 5 months ago

I usually use watchtower to keep my containers up to date. I run it in a cronjob.

Thanks, I will check it out. I'm relatively new to docker, the update process drives me nuts.

issue 1 of 1
Type
Bug
Priority
Major
Assignee
Affected Versions
9.3.1
Labels
No labels
Issue Votes (0)
Watchers (5)
Reference
onedev/server#1679
Please wait...
Page is in error, reload to recover