Docker service error "docker: not found"


I just upgraded to v 1.0 (I did a fresh installation) I really like the new UI, I want to use cross to cross build some Rust binaries, the thing is that cross needs the Docker deamon to work, so I tried to add Docker service like described here, but for somehow I have docker: not found when I try to execute Docker commands, here is my .drone.yml file, am I missing something? (The repository is trusted by the way)

kind: pipeline
name: default

- name: build
  image: rustlang/rust:nightly
    - name: dockersock
      path: /var/run/docker.sock
    - docker ps -a

  - name: dockersock
      path: /var/run/docker.sock

thank you

I have docker: not found when I try to execute Docker commands, here is my .drone.yml file, am I missing something?

yes, it would appear rustlang/rust:nightly does not have a docker executable available inside the image. You should instead use an image that includes the docker executable, such as the official docker image. You can see a working example at

Ah got you, in that case why we’ll need to share the docker sock if the image already have it?

the docker image does not have anything running inside of it, by default. So you would either need to mount the host machine docker socket or start docker in a service container.

Yes I was thinking about mounting the host machine docker socket (I think that’s what I did in the .drone.yml file) but I still can’t use it in the loaded container?

sorry, not sure I understand the question, however, we provide an example that demonstrates how to mount the host machine docker socket to use Docker in a pipeline step.

Sorry for that, the question is for a pipeline with a given image (that doesn’t contains Docker) if I mount the host machine docker socket like your example, I can use docker commands in that pipeline?

Doing an analogy with travis, for example here is a pipeline based on ruby image and that use Docker as service to execute Docker commands in that pipeline even if the image doesn’t contains Docker:

language: ruby

  - docker
  - docker pull carlad/sinatra

docker is a program installed at /bin/docker. If /bin/docker does not exist in your image, you cannot execute docker commands.

if you want to use an image with /bin/docker pre-installed, you can use the docker image.

So the ideal in this case is to build a custom image based on Docker image, and install rust on it, right?

do you have much docker experience? Why do you need a rust container to execute Docker commands?

It’s just I’m used to do that with travis like the example I put before, and here I need to run Docker with Rust image due to cross that needs Docker behind the scenes to cross compile Rust binaries, you can see it here

I am having a hard time understanding what you are trying to do because the example only shows docker ps. I need more details to help you. What commands would you run locally to build the project (e.g. on your laptop)?

The docker ps was just to test if I have access to Docker or not, but the real command in this case would be a cross build --target x86_64-unknown-linux-gnu for example

I ended up building a custom image that contains Docker with a wrapper script and Rust :slight_smile:

ok great :slight_smile: sorry, I meant to reply back and suggest this approach. Glad you got it working.

1 Like

No worries, Thanks for the help :wink: