Skip to content

Commit 8ba8f09

Browse files
committed
touching up docs
1 parent a257afd commit 8ba8f09

File tree

2 files changed

+44
-68
lines changed

2 files changed

+44
-68
lines changed

README.md

Lines changed: 44 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,3 @@
1-
# Local Zephyr Docker Image
2-
3-
This repository contains the same Dockerfiles as listed below in the forked readme section.
4-
5-
This has been modified to show how to connect a USB dongle for programming targets from docker container.
6-
7-
This has been modified to support a command line argument when building the images to set the username that is created.
8-
This allows the user to connect connect the container to the ssh-agent running on the host (the usernames are required to match).
9-
This way west or git can be used to pull down repos that require ssh keys.
10-
11-
Note that these images have been modified to build locally (originally they pulled from the pre built images). So
12-
now each image needs to be built locally in order
13-
14-
# Building the Images
15-
16-
```
17-
docker build -f Dockerfile.base \
18-
--build-arg UID=$(id -u) \
19-
--build-arg GID=$(id -g) \
20-
--build-arg USERNAME=$(id -u -n) \
21-
-t ci-base:v4.0-branch .
22-
```
23-
```
24-
docker build -f Dockerfile.ci \
25-
--build-arg UID=$(id -u) \
26-
--build-arg GID=$(id -g) \
27-
--build-arg USERNAME=$(id -u -n) \
28-
--build-arg BASE_IMAGE=ci-base:v4.0-branch \
29-
-t ci:v4.0-branch .
30-
```
31-
```
32-
docker build -f Dockerfile.devel \
33-
--build-arg UID=$(id -u) \
34-
--build-arg GID=$(id -g) \
35-
--build-arg USERNAME=$(id -u -n) \
36-
--build-arg BASE_IMAGE=ci:v4.0-branch \
37-
-t devel:v4.0-branch .
38-
```
39-
40-
# Running the devel image with SSH-Agent
41-
42-
Then to run the docker image interactively with the following command that will mount the /workdir volume and connect
43-
the SSH_AUTH_SOCK to the ssh-agent running on the host.
44-
45-
```
46-
docker run -ti \
47-
-v $HOME/west-workspace:/workdir \
48-
--mount type=bind,src=$SSH_AUTH_SOCK,target=/run/host-services/ssh-auth.sock \
49-
--env SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" \
50-
devel:v4.0-branch
51-
```
52-
# Running the devel image with USB Programming dongle.
53-
54-
This command will connect the USB device to the container (And the entrypoint.sh needs to be modified if the bus/dev values are different).
55-
Details are here https://impinj.atlassian.net/wiki/spaces/INDY/pages/911704083/Building+and+Flashing+Zephyr+in+Docker
56-
57-
TODO: pull the relevant details into this document.
58-
59-
```
60-
docker run -ti \
61-
-v $HOME/west-workspace:/workdir \
62-
--device=/dev/bus/usb/001/003 \
63-
devel:latest
64-
```
65-
66-
# Below is the Documentation from the repo this was forked from
67-
681
# Zephyr Docker Images
692

703
This repository contains the Dockerfiles for the following images:
@@ -142,6 +75,50 @@ It can be used for building Zephyr samples and tests by mounting the Zephyr work
14275
docker run -ti -v <path to zephyr workspace>:/workdir zephyr-build:v<tag>
14376
```
14477

78+
#### Using SSH Agent with Docker Image
79+
80+
The docker images can be built to use the SSH agent on the host to provide authorization
81+
to assets like restricted git repos. To do this there are a few requirements. One of which
82+
is that the user name of the processes inside the docker container must match the real user
83+
name on the host. The USERNAME build argument can be passed into the build process to override
84+
the default user name. Note that all three images need to be built locally with this USERNAME
85+
argument set correctly.
86+
87+
```
88+
docker build -f Dockerfile.base \
89+
--build-arg UID=$(id -u) \
90+
--build-arg GID=$(id -g) \
91+
--build-arg USERNAME=$(id -u -n) \
92+
-t ci-base:<tag> .
93+
```
94+
```
95+
docker build -f Dockerfile.ci \
96+
--build-arg UID=$(id -u) \
97+
--build-arg GID=$(id -g) \
98+
--build-arg USERNAME=$(id -u -n) \
99+
--build-arg BASE_IMAGE=ci-base:v4.0-branch \
100+
-t ci:<tag> .
101+
```
102+
```
103+
docker build -f Dockerfile.devel \
104+
--build-arg UID=$(id -u) \
105+
--build-arg GID=$(id -g) \
106+
--build-arg USERNAME=$(id -u -n) \
107+
--build-arg BASE_IMAGE=ci:v4.0-branch \
108+
-t devel:<tag> .
109+
```
110+
111+
Then when running the ci or devel image there are additional command line arguments to
112+
connect the host ssh-agent ports to the ssh-agent ports inside the container.
113+
114+
```
115+
docker run -ti \
116+
-v $HOME/Work/zephyrproject:/workdir \
117+
--mount type=bind,src=$SSH_AUTH_SOCK,target=/run/host-services/ssh-auth.sock \
118+
--env SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" \
119+
devel:<tag>
120+
```
121+
145122
### Usage
146123

147124
#### Building a sample application

entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ xvfb-run -n $SNUM -s "-screen 0 1024x768x24" -f ~/.Xauthority openbox-session &
55
sleep 1
66
x11vnc -display $DISPLAY -usepw -forever -quiet &
77

8-
98
exec "$@"

0 commit comments

Comments
 (0)