[SOLVED] Execute docker commands in bash script from dri=one.yml

Hi Everyone,
I have a shell script having the docker commands to build and publish a new docker image. And i am pointing to that script in drone.ymlfile but getting 'docker:command not found` error. Can anyone provide some thoughts on this?

Below the snippet of drone.yml

kind: pipeline
name: default

steps:
- name: deployment
  image: ubuntu
  commands: 
    - bash bin/launch-devenv.bash

you are running your commands inside an ubuntu docker image, which does not have the docker program installed, which is why you are getting errors. Please see the example pipelines in the Drone documentation that includes examples for working with Docker. Examples | Drone

@bradrydzewski thanks for you reply. Actually i have the docker commands inside the bash script and trying to run it from the drone steps. As you mentioned i replaced the actuall docker image but which is giving bash: not found issue which means it is not supporting bash commands. Any thoughts on this please?

kind: pipeline
name: default

steps:

  • name: test
    image: docker:dind
    volumes:
    • name: dockersock
      path: /var/run/docker.sock
      commands:
    • docker ps -a
    • bash bin/launch-devenv.bash

volumes:

  • name: dockersock
    host:
    path: /var/run/docker.sock

when you choose an image, it is your responsibility to use an image that has the necessary software installed. The image you have chosen does not have bash installed, which is why attempting to use bash restults in an error. You can rerpoduce and verify this using standard docker commands:

$ docker run -t -i docker:dind /bin/sh
/ # which /bin/sh
/bin/sh
/ # which /bin/bash
/ # echo $?
1

remember that you can also use /bin/sh in bash, as long as your scripts are compliant with posix sh syntax and do not rely on bash features.