kubesphere / devops-agent

Agents for Kubesphere DevOps
Apache License 2.0
61 stars 73 forks source link

docker: command not found when use agent image with "-podman" suffix #76

Closed usernameisnull closed 1 year ago

usernameisnull commented 1 year ago

when use "-podman" agent image, in jenkins pipeline, if I use sh 'docker ...' ,it said: docker: command not found I think this stamement is not work https://github.com/kubesphere/devops-agent/blob/d7797562cce10d844ab146fc8c6be39024d94f18/base/podman/Dockerfile#L62

LinuxSuRen commented 1 year ago

Could you please tell us the exactly image name and tag?

usernameisnull commented 1 year ago

Could you please tell us the exactly image name and tag? builder-base:v3.2.0-podman,but I think any agent image with "-podman" suffix will have this problem

usernameisnull commented 1 year ago

In jenkins pipeline, if I use docker in sh statements,this will happen,so I changed the docker to podman

stage('build & push') {
      steps {
        container('base') {
          withCredentials([usernamePassword(credentialsId: 'harbor-credential', passwordVariable: 'PASS', usernameVariable: 'USER',)]) {
            sh '''
             export IMG="myregistry.com/demo/hello:$IMAGE_TAG"
             podman login myregistry.com/demo -u $USER -p $PASS
             podman build -f Dockerfile.with-build -t \$IMG  .
             podman push \$IMG
          '''
          }
        }
      }
    }

if use docker: image

LinuxSuRen commented 1 year ago

it was fixed in https://github.com/kubesphere/devops-agent/pull/68. You could use ghcr.io/kubesphere/builder-base:v3.2.2-podman instead.

See also:

[root@node1 ~]# docker run ghcr.io/kubesphere/builder-base:v3.2.2-podman docker
Error: missing command 'docker COMMAND'
Try 'docker --help' for more information.
usernameisnull commented 1 year ago

nice

usernameisnull commented 1 year ago

there is another problem: I found that your other 3.2.2-podman images still have this problem,like:kubespheredev/builder-maven:v3.2.2-podman you still use alias not ln -s image

LinuxSuRen commented 1 year ago

The alias does not work well in kubespheredev/builder-maven:v3.2.2-podman due to the following file

https://github.com/kubesphere/devops-agent/blob/d7797562cce10d844ab146fc8c6be39024d94f18/maven/podman/Dockerfile#L1

[root@node1 ~]# docker run kubespheredev/builder-base:v3.1.0-podman docker
Unable to find image 'kubespheredev/builder-base:v3.1.0-podman' locally
v3.1.0-podman: Pulling from kubespheredev/builder-base
2d473b07cdd5: Already exists
e65f63f3b9a3: Pull complete
454ff74a4e2c: Pull complete
66a2618fa589: Pull complete
ca3d576eed8b: Pull complete
c1afdb9dd30e: Pull complete
4433dd62b7ed: Pull complete
833077868859: Pull complete
674f640f3602: Pull complete
aa88434b7195: Pull complete
Digest: sha256:5e843645f3c07bbfcc191e93d879b41d1d73f09e5a9d4ecf9d1712c8d04c5467
Status: Downloaded newer image for kubespheredev/builder-base:v3.1.0-podman
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "docker": executable file not found in $PATH: unknown.
ERRO[0085] error waiting for container: context canceled

I think we should upgrade the base image. Please feel free to do it if you're interested in it.