# How to deploy drone on raspberry pi?

**URL:** <https://drone.discourse.group/t/how-to-deploy-drone-on-raspberry-pi/10989>\
**Category:** Drone Support\
**Created:** [December 10, 2017, 8:27am UTC](https://drone.discourse.group/t/how-to-deploy-drone-on-raspberry-pi/10989 "2017-12-10T08:27:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ling7334](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/ling7334/32/3853_2.png) [@ling7334](https://drone.discourse.group/u/ling7334)\
**Post date:** [December 10, 2017, 8:27am UTC](https://drone.discourse.group/t/how-to-deploy-drone-on-raspberry-pi/10989/1 "2017-12-10T08:27:30Z")

</div>

So far I’ve try the image on the dockerhub, nothing work.

I successfully build and run drone on my host machine, however not working on docker.  
Compile on a pi and build a image frome _armhf/alpine_ _arm32v6/alpine_ _arm64v8/alpine_, all failed with

> standard\_init\_linux.go:195: exec user process caused “exec format error”

Any one successfully deploy on raspberry pi?

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [December 10, 2017, 3:17pm UTC](https://drone.discourse.group/t/how-to-deploy-drone-on-raspberry-pi/10989/2 "2017-12-10T15:17:54Z")

</div>

> [@On another topic](https://drone.discourse.group/t/1221/1):
>
> standard\_init\_linux.go:195: exec user process caused “exec format error”

This error is a low-level Go error that indicates the binary has not been compiled for the correct architecture. You need to make sure you compile the Drone binary for the correct target architecture and the correct arm version, using the correct GOARM, GOOS and GOARCH. Note that the Drone binary cannot be cross-compiled. This means you must compile the Drone binary directly on the Raspberry Pi.

> [@On another topic](https://drone.discourse.group/t/1221/1):
>
> build a image frome armhf/alpine arm32v6/alpine arm64v8/alpine

The main Dockerfile in the project will work on any architecture. You do not need to change the main Dockerfile or base image.

---

<div class="post-metadata">

**Author:** ![ling7334](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/ling7334/32/3853_2.png) [@ling7334](https://drone.discourse.group/u/ling7334)\
**Post date:** [December 11, 2017, 1:11am UTC](https://drone.discourse.group/t/how-to-deploy-drone-on-raspberry-pi/10989/3 "2017-12-11T01:11:07Z")

</div>

> [@On another topic](https://drone.discourse.group/t/1221/2):
>
> You need to make sure you compile the Drone binary for the correct target architecture and the correct arm version, using the correct GOARM, GOOS and GOARCH.

I am compile on the Raspberry Pi, but not specify the GOARM, GOOS and GOARCH. Can you suggest the correct values. I’m using a Raspberry Pi 3 Model B

> The Raspberry Pi 3 is the third-generation Raspberry Pi. It replaced the Raspberry Pi 2 Model B in February 2016.
> 
> - Quad Core 1.2GHz Broadcom BCM2837 64bit CPU
> - 1GB RAM
> - BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
> - 40-pin extended GPIO
> - 4 USB 2 ports
> - 4 Pole stereo output and composite video port
> - Full size HDMI
> - CSI camera port for connecting a Raspberry Pi camera
> - DSI display port for connecting a Raspberry Pi touchscreen display
> - Micro SD port for loading your operating system and storing data
> - Upgraded switched Micro USB power source up to 2.5A

My guess is GOARM=7, GOOS=linux and GOARCH=arm, can you confirm that.

The thing is that I’ve successfully compile and run it on the host machine(raspberry pi 3b), which means the architecture is correct, right? But failed on docker image.

many thanks

---

<div class="post-metadata">

**Author:** ![ling7334](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/ling7334/32/3853_2.png) [@ling7334](https://drone.discourse.group/u/ling7334)\
**Post date:** [December 15, 2017, 12:59pm UTC](https://drone.discourse.group/t/how-to-deploy-drone-on-raspberry-pi/10989/4 "2017-12-15T12:59:50Z")

</div>

```
# build a static binary with the build number and extra features.
go build -ldflags '-extldflags "-static" -X github.com/drone/drone/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-server github.com/drone/drone/extras/cmd/drone-server
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-X github.com/drone/drone/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-agent github.com/drone/drone/cmd/drone-agent
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags '-X github.com/drone/drone/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/linux/arm64/drone-agent github.com/drone/drone/cmd/drone-agent
GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags '-X github.com/drone/drone/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/linux/arm/drone-agent github.com/drone/drone/cmd/drone-agent

```

I should build static binary. And community edition does not contain extra feature.

`go build -ldflags '-extldflags "-static" -X github.com/drone/drone/version.VersionDev=build.'${DRONE_BUILD_NUMBER} -o release/drone-server github.com/drone/drone/cmd/drone-server`

Finally it work, thanks!
