# Mender Client inside Docker container

**URL:** <https://hub.mender.io/t/mender-client-inside-docker-container/1971>\
**Category:** General Discussions\
**Tags:** yocto, standalone\
**Created:** [May 26, 2020, 2:40pm UTC](https://hub.mender.io/t/mender-client-inside-docker-container/1971 "2020-05-26T14:40:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dewey](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@Dewey](https://hub.mender.io/u/Dewey)\
**Post date:** [May 26, 2020, 2:40pm UTC](https://hub.mender.io/t/mender-client-inside-docker-container/1971/1 "2020-05-26T14:40:57Z")

</div>

Hello,

Would it be possible to run the Mender client inside a docker container that runs in privileged mode ? The container could access /dev and other requirements. Mender would on an x86 board with grub as bootloader and in standalone mode.

Have someone already tested it?

Thanks

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [May 27, 2020, 4:26pm UTC](https://hub.mender.io/t/mender-client-inside-docker-container/1971/2 "2020-05-27T16:26:51Z")

</div>

Hi @Dewey, I’m not aware of anyone having tried this but as long as the client has block-level access to the device nodes, proper mounts of /usr/share/mender, and the ability to run fw\_printenv and fw\_setenv, I see no reason it wouldn’t work. Please let us know if you try it, and what requirements the container must have if there are more than listed above.  
Drew

---

<div class="post-metadata">

**Author:** ![Dewey](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@Dewey](https://hub.mender.io/u/Dewey)\
**Post date:** [June 25, 2020, 12:15pm UTC](https://hub.mender.io/t/mender-client-inside-docker-container/1971/3 "2020-06-25T12:15:47Z")

</div>

Sorry for the pretty long delay, I’m currently trying to run Mender in a container. The system image is Yocto based.

I created the following Dockerfile:

```
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install lzma
COPY mender /usr/bin/

```

So that Mender has all the dependencies that it needs.  
When running ldd on the Mender binaries, it seems ok:

> root@6a97c6b3c079:/# ldd /usr/bin/mender  
> linux-vdso.so.1 (0x00007fff65b84000)  
> liblzma.so.5 =\> /lib/x86\_64-linux-gnu/liblzma.so.5 (0x00007fbfa5fa0000)  
> libpthread.so.0 =\> /lib/x86\_64-linux-gnu/libpthread.so.0 (0x00007fbfa5d81000)  
> libc.so.6 =\> /lib/x86\_64-linux-gnu/libc.so.6 (0x00007fbfa5990000)  
> libdl.so.2 =\> /lib/x86\_64-linux-gnu/libdl.so.2 (0x00007fbfa578c000)  
> /lib/ld-linux-x86-64.so.2 =\> /lib64/ld-linux-x86-64.so.2 (0x00007fbfa61c6000)

In addition the file has the right permission:

```
root@6a97c6b3c079:/# ls -lash /usr/bin/mender
7.8M -rwxr-xr-x 1 root root 7.8M Jun 25 11:21 /usr/bin/mender

```

As for the access to the host device I shared the following directory:

`--privileged -v /dev:/dev -v /usr/share/mender:/usr/share/mender -v /data:/data -v /etc/mender:/etc/mender`

However, when calling “./mender”, I get the following error:

`bash: ./mender: No such file or directory`

To get the mender binary, I simply copied it from the host device to the docker filesystem, may it be the problem ? Should I recompile the client from sources ?

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [June 26, 2020, 10:21am UTC](https://hub.mender.io/t/mender-client-inside-docker-container/1971/4 "2020-06-26T10:21:21Z")

</div>

Is it the executable bit set inside the Docker container?

---

<div class="post-metadata">

**Author:** ![Dewey](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@Dewey](https://hub.mender.io/u/Dewey)\
**Post date:** [June 26, 2020, 11:10am UTC](https://hub.mender.io/t/mender-client-inside-docker-container/1971/5 "2020-06-26T11:10:59Z")

</div>

Yes, I did it that way (inside the container) and it did not resolve the problem:

```
root@1152740f5ef8:/usr/bin# chmod +x mender
root@1152740f5ef8:/usr/bin# ls -lash mender
7.8M -rwxr-xr-x 1 root root 7.8M Jun 25 11:21 mender
root@1152740f5ef8:/usr/bin# ./mender
bash: ./mender: No such file or directory

```

Running strace does not provide more information:

```
root@1152740f5ef8:/usr/bin# strace ./mender
execve("./mender", ["./mender"], 0x7fff3b10c3d0 /* 9 vars */) = -1 ENOENT (No such file or directory)
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
getpid() = 58
exit_group(1) = ?
+++ exited with 1 +++
```
