0%

Ansible configuration

Before running ansible,I am going to write a default inventory which will be used when I am running site.yml.

1
2
[defaults]
inventory = hosts

Ansible commands

Instead of using ansible playbook, I can also use ansible command to run automation, for example, I am going to check remote nodes directories, I can use ansible command to do that directly, no need to login romote node to check.

1
2
3
4
5
6
7
8
anna@ansible-controller:~/Desktop/ansible-code/inventory/modules/files-modules/inventory$ ansible all -m shell -a "ls /etc/tmp"
ansible-node1 | SUCCESS | rc=0 >>
ansible-file-test.txt
ansible-file-test.txt.16075.2020-05-24@22:58:43~

cube4200 | SUCCESS | rc=0 >>
ansible-file-test.txt
ansible-file-test.txt.11629.2020-05-24@15:58:44~

The command I used is ansible all -m shell -a "ls /etc/tmp"

some examples of how to use modules

Utilities modules -> debug -> print statements during execution

In this module, only three parameters.

1
2
3
4
5
6
7
- name: hello world
hosts: localhost
tasks:
- name: hello world
debug:
msg: "hello ansible"
verbosity: 0 # 0 is default, 1-3 parameters will skip the message
Read more »

what is Ansible

Ansible is an IT automation tool. It can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates.

There are three main parts in Ansible: inventory, playbook and modules.

Inventory

Inventory is a list of managed nodes. An inventory file is also sometimes called a “hostfile”. Your inventory can specify information like IP address for each managed node. An inventory can also organize managed nodes, creating and nesting groups for easier scaling.

For my enviroment, there are two nodes:

1
2
3
4
[web1]
ansible-node1 ansible_connection=ssh ansible_user=pi
[web2]
cube4200 ansible_connection=ssh ansible_user=anna

Playbooks

Playbooks are Ansible’s configuration, deployment and orchestration language. Each playbook is composed of one or more ‘plays’ in a list.

Playsbook is yaml file. there are listed tasks you want ansible to work.
Playbook is the most important file in ansible.

In playbooks, there are some important concepts, such as variables, variables files, loops.

variables

playbook variables can be wrote directly in playbook or in variable files. all kinds variabls have their precendence during playbook exectued.

Read more »

I am going to use Travis to continue create docker multiarch images, then push back to dockerhub repo.

create a repo in my github account named travis-CICD and add it to Travis GitHub Apps Integration

under the travis-CICD repo, create a .travis.yml file

Since github uses ruby, I don’t need to specify the language. For this project, I am going to work on docker, so I need to start docker.
I am going to use two docker images to create a multiarch using docker manifest create command.
Note: Because manifest is an experimental feature, I need to add DOCKER_CLI_EXPERIMENTAL=enabled in .travis.yml file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
sudo: required
addons:
apt:
update: true
packages:
- docker-ce
services:
- docker
before_install:
script:
- docker pull treehouses/turtleblocksjs-tags:nginx-x86
- docker pull treehouses/turtleblocksjs-tags:nginx-rpi
- export DOCKER_CLI_EXPERIMENTAL=enabled
- docker manifest create vmnet8/turtleblocksjs:annarocks2 treehouses/turtleblocksjs-tags:nginx-x86
treehouses/turtleblocksjs-tags:nginx-rpi
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker manifest push vmnet8/turtleblocksjs:annarocks2
env:
global:

Go to dockerhub to get a new token

Read more »

Want to monitor your system and applications, Netdata is distributed, real-time performance and health monitoring for these. It is a highly-optimized monitoring agent you install on all your systems and containers.

I tried to use docker image to use netdata.

Install netdata docker image and run it

It simply straightforward, just run docker command:

1
2
3
4
5
6
7
8
9
10
docker run -d --name=netdata \
-p 19999:19999 \
-v /etc/passwd:/host/etc/passwd:ro \
-v /etc/group:/host/etc/group:ro \
-v /proc:/host/proc:ro \
-v /sys:/host/sys:ro \
-v /etc/os-release:/host/etc/os-release:ro \
--cap-add SYS_PTRACE \
--security-opt apparmor=unconfined \
netdata/netdata

then go to your browser, http://yourip:19999, you can see netdata works.

use docker compose yml file to run netdata service

write a shell script to create a docker yml file under /srv

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

#create netdata.yml
mkdir -p /srv/netdata/
{
echo "version: '3'"
echo "services:"
echo " netdata:"
echo " image: netdata/netdata"
echo " ports:"
echo " - 19999:19999"
echo " cap_add:"
echo " - SYS_PTRACE"
echo " security_opt:"
echo " - apparmor:unconfined"
echo " volumes:"
echo " - /etc/passwd:/host/etc/passwd:ro"
echo " - /etc/os-release:/host/etc/os-release:ro"
echo " - /etc/group:/host/etc/group:ro"
echo " - /proc:/host/proc:ro"
echo " - /sys:/host/sys:ro"
} > /srv/netdata/netdata.yml

run it, then go to /srv/netdata to check if it exists

at the same dir to create an autorun file, named netdata_auto

1
2
3
4
5
netdata_autorun=true

if [ "$netdata_autorun" = true ]; then
docker-compose -f /srv/netdata/netdata.yml -p netdata up -d
fi

let me test

run shell script first

1
root@rpi-121:/home/pi/git_repo/cli/templates/services/netdata# ./netdata_yml.sh

go to /srv to verify it created the docker compose yml file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
root@rpi-121:/home/pi/git_repo/cli/templates/services/netdata# cat /srv/netdata/netdata.yml 
version: '3'
services:
netdata:
image: netdata/netdata
ports:
- 19999:19999
cap_add:
- SYS_PTRACE
security_opt:
- apparmor:unconfined
volumes:
- /etc/passwd:/host/etc/passwd:ro
- /etc/os-release:/host/etc/os-release:ro
- /etc/group:/host/etc/group:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro

then run docker-compose

1
2
3
4
5
6
7
8
9
10
11
12
13
14
root@rpi-121:/home/pi/git_repo/cli/templates/services/netdata# docker-compose -f /srv/netdata/netdata.yml -p netdata up -d
Creating network "netdata_default" with the default driver
Pulling netdata (netdata/netdata:)...
latest: Pulling from netdata/netdata
2aa204966f9a: Pull complete
8dde373fbef5: Pull complete
042f66a41d56: Pull complete
3526782612f0: Pull complete
c2b930d703fa: Pull complete
9b859bae4175: Pull complete
f3e46298693e: Pull complete
Digest: sha256:b49e1901fd8aae43d950c171c14449b5080a5550faa97594e2d4ccee7ed3aac8
Status: Downloaded newer image for netdata/netdata:latest
Creating netdata_netdata_1 ... done

check if the docker image is pulled and run

1
2
3
root@rpi-121:/home/pi/git_repo/cli/templates/services/netdata# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
netdata/netdata latest d170142fbe20 19 hours ago 249MB

it worked well

go to browser http://myip:19999

Read more »

go to github.com/treehouses/rpi-nginx dir
modifid Dockerfile

run docker build
root@vmnet8cloud:~/git_repo/treehouses/rpi-nginx# docker build -t vmnet8/preplanet:rpi-1.1 .

root@vmnet8cloud:/git_repo/treehouses/rpi-nginx# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
treehouses/rpi-nginx 1.0 1bd2ae323561 3 minutes ago 50.7MB
root@vmnet8cloud:
/git_repo/treehouses/rpi-nginx# docker run -d treehouses/rpi-nginx:1.0
22992681fb717fcf19cd9691dbaf7089b2280e0667881e8d0ce18b9a1a82da70
root@vmnet8cloud:~/git_repo/treehouses/rpi-nginx# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
22992681fb71 treehouses/rpi-nginx:1.0 “/usr/bin/entry.sh n…” 9 seconds ago Up 8 seconds 80/tcp, 443/tcp mystifying_rhodes

root@vmnet8cloud:~/git_repo/treehouses/rpi-nginx# docker push treehouses/rpi-nginx:1.0
The push refers to repository [docker.io/treehouses/rpi-nginx]
7023a6605ba3: Pushed
64ac289193c5: Pushed
4b51db9fecf2: Mounted from vmnet8/preplanet
4206eb6099cb: Mounted from vmnet8/preplanet
3d13333fb74a: Mounted from vmnet8/preplanet
6eca2d86fb5c: Mounted from vmnet8/preplanet
9863749692b7: Mounted from vmnet8/preplanet
77ffeb9e9842: Mounted from vmnet8/rpi-nginx
1.0: digest: sha256:acb7fc62ea8ba61ad58c17f774c35c8c3284a51dda29c575935c732655271c60 size: 1995

going to create a multi-arch docker hub

root@vmnet8cloud:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
treehouses/rpi-nginx 1.0 1bd2ae323561 2 hours ago 50.7MB
nginx 1.14.0-alpine 68513e2e4bce 16 months ago 14.4MB

I need use nginx:1.16.0-alpine to create multi-arch dockerhub image, so

root@vmnet8cloud:~# docker pull nginx:1.16.0-alpine

run

root@vmnet8cloud:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
treehouses/rpi-nginx 1.0 1bd2ae323561 2 hours ago 50.7MB
nginx 1.16.0-alpine 05edf438c0e4 8 months ago 17.6MB
nginx 1.14.0-alpine 68513e2e4bce 16 months ago 14.4MB

In order to create docker manifest list, I need to modify the docker image’s tag

root@vmnet8cloud:# docker tag treehouses/rpi-nginx:1.0 treehouses/nginx:rpi
root@vmnet8cloud:
# docker tag nginx:1.16.0-alpine treehouses/nginx:x86

After change the tags, it shows new image name

root@vmnet8cloud:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
treehouses/nginx rpi 1bd2ae323561 2 hours ago 50.7MB
treehouses/rpi-nginx 1.0 1bd2ae323561 2 hours ago 50.7MB
nginx 1.16.0-alpine 05edf438c0e4 8 months ago 17.6MB
treehouses/nginx x86 05edf438c0e4 8 months ago 17.6MB
nginx 1.14.0-alpine 68513e2e4bce 16 months ago 14.4MB

I need to push these two new images (name) to dockerhub

root@vmnet8cloud:/git_repo/treehouses/rpi-nginx# docker push treehouses/nginx:rpi
root@vmnet8cloud:
/git_repo/treehouses/rpi-nginx# docker push treehouses/nginx:x86

create a multi-arch docker image

root@vmnet8cloud:~/git_repo/treehouses/rpi-nginx# docker manifest create treehouses/nginx:latest treehouses/nginx:x86 treehouses/nginx:rpi

Last steps to push this multi-arch to docker hub

root@vmnet8cloud:~/git_repo/treehouses/rpi-nginx# docker manifest push treehouses/nginx

I need to rewrite a Dockerfile to create my own Dockerfile.
I pull a docker image base from dockerhub first.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
FROM balenalib/raspberry-pi-alpine:3.9

LABEL org.opencontainers.image.authors="Tobias Hargesheimer <docker@ison.ws>" \
org.opencontainers.image.title="NGINX" \
org.opencontainers.image.description="AlpineLinux with NGINX on arm arch" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.url="https://hub.docker.com/r/tobi312/rpi-nginx/" \
org.opencontainers.image.source="https://github.com/Tob1asDocker/rpi-nginx"

ARG CROSS_BUILD_START=":"
ARG CROSS_BUILD_END=":"

RUN [ ${CROSS_BUILD_START} ]

ENV NGINX_VERSION 1.14

RUN apk --no-cache add nginx>${NGINX_VERSION} \
&& mkdir -p /run/nginx \
&& sed -i "s/ssl_session_cache shared:SSL:2m;/#ssl_session_cache shared:SSL:2m;/g" /etc/nginx/nginx.conf

# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log

# fix: *** stack smashing detected ***: nginx: worker process terminated / [alert] 9#9: worker process *process-id* exited on signal 6
#RUN sed -i "s/worker_processes auto;/worker_processes 1;/g" /etc/nginx/nginx.conf

EXPOSE 80 443

CMD ["nginx", "-g", "daemon off;"]

RUN [ ${CROSS_BUILD_END} ]

For this image, its base is balenalib/raspberry-pi-alpine:3.9. when I am going to build my own docker image, it has the newest version, but I still use the old one, because it will be more stable for me.

I add some new command unders this docker base Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM balenalib/raspberry-pi-alpine:3.9

LABEL org.opencontainers.image.authors="Tobias Hargesheimer <docker@ison.ws>" \
org.opencontainers.image.title="NGINX" \
org.opencontainers.image.description="AlpineLinux with NGINX on arm arch" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.url="https://hub.docker.com/r/tobi312/rpi-nginx/" \
org.opencontainers.image.source="https://github.com/Tob1asDocker/rpi-nginx"

ARG CROSS_BUILD_START=":"
ARG CROSS_BUILD_END=":"

RUN [ ${CROSS_BUILD_START} ]

ENV NGINX_VERSION 1.14

RUN apk --no-cache add nginx>${NGINX_VERSION} \
&& mkdir -p /run/nginx \
&& sed -i "s/ssl_session_cache shared:SSL:2m;/#ssl_session_cache shared:SSL:2m;/g" /etc/nginx/nginx.conf

# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log

# fix: *** stack smashing detected ***: nginx: worker process terminated / [alert] 9#9: worker process *process-id* exited on signal 6
#RUN sed -i "s/worker_processes auto;/worker_processes 1;/g" /etc/nginx/nginx.conf

EXPOSE 80 443

CMD ["nginx", "-g", "daemon off;"]

RUN [ ${CROSS_BUILD_END} ]
RUN apk add --no-cache \
fcgi=2.4.0-r8 \
fcgiwrap=1.1.0-r3 \
spawn-fcgi=1.6.4-r3 \
ca-certificates=20190108-r0 \
nghttp2-libs=1.35.1-r0 \
libssh2=1.8.2-r0 \
libcurl=7.64.0-r2 \
curl=7.64.0-r2 \
oniguruma=6.9.4-r0 \
jq=1.6-r0

Notice: the packages need to be installed all have version numbers which will cause the error in the following.

After modify the Dockerfile, I am going to build my docker image.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
root@vmnet8cloud:~/git_repo/preplanet/docker/planet# docker build -t vmnet8/preplanet:rpi-1 .
Sending build context to Docker daemon 4.096kB
Step 1/12 : FROM balenalib/raspberry-pi-alpine:3.9
---> d6c5aebf964a
Step 2/12 : LABEL org.opencontainers.image.authors="Tobias Hargesheimer <docker@ison.ws>" org.opencontainers.image.title="NGINX" org.opencontainers.image.description="AlpineLinux with NGINX on arm arch" org.opencontainers.image.licenses="Apache-2.0" org.opencontainers.image.url="https://hub.docker.com/r/tobi312/rpi-nginx/" org.opencontainers.image.source="https://github.com/Tob1asDocker/rpi-nginx"
---> Using cache
---> 1a8a69474af2
Step 3/12 : ARG CROSS_BUILD_START=":"
---> Using cache
---> 2ea7d76cc571
Step 4/12 : ARG CROSS_BUILD_END=":"
---> Using cache
---> 9dac95067f17
Step 5/12 : RUN [ ${CROSS_BUILD_START} ]
---> Using cache
---> e1d8ae03657f
Step 6/12 : ENV NGINX_VERSION 1.14
---> Using cache
---> 684896377216
Step 7/12 : RUN apk --no-cache add nginx>${NGINX_VERSION} && mkdir -p /run/nginx && sed -i "s/ssl_session_cache shared:SSL:2m;/#ssl_session_cache shared:SSL:2m;/g" /etc/nginx/nginx.conf
---> Using cache
---> ef20e56136c1
Step 8/12 : RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
---> Using cache
---> 8d95b6ad6846
Step 9/12 : EXPOSE 80 443
---> Using cache
---> a12bf17fcaea
Step 10/12 : CMD ["nginx", "-g", "daemon off;"]
---> Using cache
---> 1f6e9eb85851
Step 11/12 : RUN [ ${CROSS_BUILD_END} ]
---> Using cache
---> 969cc49b4faf
Step 12/12 : RUN apk add --no-cache fcgi=2.4.0-r8 fcgiwrap=1.1.0-r3 spawn-fcgi=1.6.4-r3 ca-certificates=20190108-r0 nghttp2-libs=1.35.1-r0 libssh2=1.8.2-r0 libcurl=7.64.0-r2 curl=7.64.0-r2 oniguruma=6.9.4-r0 jq=1.6-r0
---> Running in 910227bcece4
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/armhf/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/armhf/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
nghttp2-libs-1.35.1-r1:
breaks: world[nghttp2-libs=1.35.1-r0]
satisfies: libcurl-7.64.0-r3[so:libnghttp2.so.14]
libssh2-1.9.0-r1:
breaks: world[libssh2=1.8.2-r0]
satisfies: libcurl-7.64.0-r3[so:libssh2.so.1]
libcurl-7.64.0-r3:
breaks: world[libcurl=7.64.0-r2]
satisfies: curl-7.64.0-r3[so:libcurl.so.4]
curl-7.64.0-r3:
breaks: world[curl=7.64.0-r2]
The command '/bin/sh -c apk add --no-cache fcgi=2.4.0-r8 fcgiwrap=1.1.0-r3 spawn-fcgi=1.6.4-r3 ca-certificates=20190108-r0 nghttp2-libs=1.35.1-r0 libssh2=1.8.2-r0 libcurl=7.64.0-r2 curl=7.64.0-r2 oniguruma=6.9.4-r0 jq=1.6-r0' returned a non-zero code: 4

It shows error.

I modified the Dockerfile again and move off all packages versions like following

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM balenalib/raspberry-pi-alpine:3.9

LABEL org.opencontainers.image.authors="Tobias Hargesheimer <docker@ison.ws>" \
org.opencontainers.image.title="NGINX" \
org.opencontainers.image.description="AlpineLinux with NGINX on arm arch" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.url="https://hub.docker.com/r/tobi312/rpi-nginx/" \
org.opencontainers.image.source="https://github.com/Tob1asDocker/rpi-nginx"

ARG CROSS_BUILD_START=":"
ARG CROSS_BUILD_END=":"

RUN [ ${CROSS_BUILD_START} ]

ENV NGINX_VERSION 1.14

RUN apk --no-cache add nginx>${NGINX_VERSION} \
&& mkdir -p /run/nginx \
&& sed -i "s/ssl_session_cache shared:SSL:2m;/#ssl_session_cache shared:SSL:2m;/g" /etc/nginx/nginx.conf

# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log

# fix: *** stack smashing detected ***: nginx: worker process terminated / [alert] 9#9: worker process *process-id* exited on signal 6
#RUN sed -i "s/worker_processes auto;/worker_processes 1;/g" /etc/nginx/nginx.conf

EXPOSE 80 443

CMD ["nginx", "-g", "daemon off;"]

RUN [ ${CROSS_BUILD_END} ]
RUN apk add --no-cache \
fcgi \
fcgiwrap \
spawn-fcgi \
ca-certificates \
nghttp2-libs \
libssh2 \
libcurl \
curl \
oniguruma \
jq

then build docker image again

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
root@vmnet8cloud:~/git_repo/preplanet/docker/planet# docker build -t vmnet8/preplanet:rpi-1 .
Sending build context to Docker daemon 6.144kB
Step 1/12 : FROM balenalib/raspberry-pi-alpine:3.9
---> d6c5aebf964a
Step 2/12 : LABEL org.opencontainers.image.authors="Tobias Hargesheimer <docker@ison.ws>" org.opencontainers.image.title="NGINX" org.opencontainers.image.description="AlpineLinux with NGINX on arm arch" org.opencontainers.image.licenses="Apache-2.0" org.opencontainers.image.url="https://hub.docker.com/r/tobi312/rpi-nginx/" org.opencontainers.image.source="https://github.com/Tob1asDocker/rpi-nginx"
---> Using cache
---> 1a8a69474af2
Step 3/12 : ARG CROSS_BUILD_START=":"
---> Using cache
---> 2ea7d76cc571
Step 4/12 : ARG CROSS_BUILD_END=":"
---> Using cache
---> 9dac95067f17
Step 5/12 : RUN [ ${CROSS_BUILD_START} ]
---> Using cache
---> e1d8ae03657f
Step 6/12 : ENV NGINX_VERSION 1.14
---> Using cache
---> 684896377216
Step 7/12 : RUN apk --no-cache add nginx>${NGINX_VERSION} && mkdir -p /run/nginx && sed -i "s/ssl_session_cache shared:SSL:2m;/#ssl_session_cache shared:SSL:2m;/g" /etc/nginx/nginx.conf
---> Using cache
---> ef20e56136c1
Step 8/12 : RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
---> Using cache
---> 8d95b6ad6846
Step 9/12 : EXPOSE 80 443
---> Using cache
---> a12bf17fcaea
Step 10/12 : CMD ["nginx", "-g", "daemon off;"]
---> Using cache
---> 1f6e9eb85851
Step 11/12 : RUN [ ${CROSS_BUILD_END} ]
---> Using cache
---> 969cc49b4faf
Step 12/12 : RUN apk add --no-cache fcgi fcgiwrap spawn-fcgi ca-certificates nghttp2-libs libssh2 libcurl curl oniguruma jq
---> Running in 95d22279f720
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/armhf/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/armhf/APKINDEX.tar.gz
(1/5) Installing fcgi (2.4.0-r8)
(2/5) Installing fcgiwrap (1.1.0-r3)
Executing fcgiwrap-1.1.0-r3.pre-install
(3/5) Installing oniguruma (6.9.4-r0)
(4/5) Installing jq (1.6-r0)
(5/5) Installing spawn-fcgi (1.6.4-r3)
Executing busybox-1.29.3-r10.trigger
OK: 52 MiB in 77 packages
Removing intermediate container 95d22279f720
---> 7ee7b73f89ee
Successfully built 7ee7b73f89ee
Successfully tagged vmnet8/preplanet:rpi-1

After building, test the running container

1
2
3
4
5
6
7
8
9
10
11
12
13
14
run docer image vmnet8/preplanet:rpi-1
root@vmnet8cloud:~/git_repo/preplanet/docker/planet# docker run -d vmnet8/preplanet:rpi-1
b974aee9b9bb0d6242dcbab12e975585ff1e2d4b887860523b6d0b261863d562
root@vmnet8cloud:~/git_repo/preplanet/docker/planet# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b974aee9b9bb vmnet8/preplanet:rpi-1 "/usr/bin/entry.sh n…" 9 seconds ago Up 7 seconds 80/tcp, 443/tcp goofy_banach
270cf6e3e185 vmnet8/preplanet:rpi-1 "/usr/bin/entry.sh n…" 2 minutes ago Exited (0) About a minute ago cranky_wing
7259cecd0e74 969cc49b4faf "/bin/sh -c 'apk add…" 11 hours ago Exited (99) 11 hours ago dreamy_brown
910227bcece4 969cc49b4faf "/bin/sh -c 'apk add…" 11 hours ago Exited (4) 11 hours ago modest_wu
d4f32b1bc836 68513e2e4bce "/bin/sh -c 'apk add…" 14 hours ago Exited (6) 14 hours ago frosty_herschel
baa0a10c37a7 324ab2e7954e "/bin/sh -c 'bash ./…" 4 weeks ago Exited (127) 4 weeks ago cranky_herschel
b5ba36510956 vmnet8/preplanet:rpi "/usr/bin/entry.sh n…" 4 weeks ago Up 4 weeks 443/tcp, 0.0.0.0:20006->80/tcp heuristic_chaplygin

201,0-1 Bot

It shows it works.

In this article I am trying to build a multi-arch image that supports arm and amd64, then I will push it to Docker Hub.

Build docker image

Two dockfiles have different arch.

Build an arm arch

Dockfile

1
2
3
4
5
6
7
8
9
10
11
12
13
FROM tobi312/rpi-nginx@sha256:b375cd9a4511f5d7763397c5a4faa1f5c3605507db97075b12582aad2a6871b0
RUN rm -rf /usr/share/nginx/html/*
RUN apk add --no-cache \
fcgi=2.4.0-r8 \
fcgiwrap=1.1.0-r3 \
spawn-fcgi=1.6.4-r3 \
ca-certificates=20190108-r0 \
nghttp2-libs=1.35.1-r0 \
libssh2=1.8.2-r0 \
libcurl=7.64.0-r2 \
curl=7.64.0-r2 \
oniguruma=6.9.4-r0 \
jq=1.6-r0

change directory under this dockfile to build image

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
root@vmnet8cloud:~/rpi# docker build . -t vmnet8/rpi
Sending build context to Docker daemon 3.072kB
Step 1/3 : FROM tobi312/rpi-nginx@sha256:b375cd9a4511f5d7763397c5a4faa1f5c3605507db97075b12582aad2a6871b0
sha256:b375cd9a4511f5d7763397c5a4faa1f5c3605507db97075b12582aad2a6871b0: Pulling from tobi312/rpi-nginx
6e39823df636: Already exists
38dd00ade3c1: Already exists
c02057c17ddc: Already exists
e6d776bad3ac: Already exists
92ca2fd255df: Already exists
a2cfa1cf1cbb: Already exists
35e3be655ed6: Already exists
f182036f54c2: Already exists
Digest: sha256:b375cd9a4511f5d7763397c5a4faa1f5c3605507db97075b12582aad2a6871b0
Status: Downloaded newer image for tobi312/rpi-nginx@sha256:b375cd9a4511f5d7763397c5a4faa1f5c3605507db97075b12582aad2a6871b0
---> 91ed615e0b64
Step 2/3 : RUN rm -rf /usr/share/nginx/html/*
---> Running in aa2b4077aa07
Removing intermediate container aa2b4077aa07
---> 9412dc8b27c2
Step 3/3 : RUN apk add --no-cache fcgi=2.4.0-r8 fcgiwrap=1.1.0-r3 spawn-fcgi=1.6.4-r3 ca-certificates=20190108-r0 nghttp2-libs=1.35.1-r0 libssh2=1.8.2-r0 libcurl=7.64.0-r2 curl=7.64.0-r2 oniguruma=6.9.4-r0 jq=1.6-r0
---> Running in a6902c745dd5
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/armhf/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/armhf/APKINDEX.tar.gz
(1/5) Installing fcgi (2.4.0-r8)
(2/5) Installing fcgiwrap (1.1.0-r3)
Executing fcgiwrap-1.1.0-r3.pre-install
(/5) Installing oniguruma (6.9.4-r0)
(4/5) Installing jq (1.6-r0)
(5/5) Installing spawn-fcgi (1.6.4-r3)
Executing busybox-1.29.3-r10.trigger
OK: 52 MiB in 77 packages
Removing intermediate container a6902c745dd5
---> 758ef3313bac
Successfully built 758ef3313bac
Successfully tagged vmnet8/rpi:latest

Build an amd64 arch

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
FROM nginx:1.16.0-alpine

RUN rm -rf /usr/share/nginx/html/*
RUN apk add --no-cache \
fcgi=2.4.0-r8 \
fcgiwrap=1.1.0-r3 \
spawn-fcgi=1.6.4-r3 \
ca-certificates=20190108-r0 \
nghttp2-libs=1.35.1-r1 \
libssh2=1.9.0-r1 \
libcurl=7.64.0-r3 \
curl=7.64.0-r3 \
oniguruma=6.9.4-r0 \
jq=1.6-r0

build processing

1
2
3
4
5
6
7
8
9
10
11
root@vmnet8cloud:~/template# docker build . -t vmnet8/planet
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM nginx:1.16.0-alpine
---> 05edf438c0e4
Step 2/3 : RUN rm -rf /usr/share/nginx/html/*
---> Using cache
---> f7441287619e
Step 3/3 : RUN apk add --no-cache fcgi=2.4.0-r8 fcgiwrap=1.1.0-r3 spawn-fcgi=1.6.4-r3 ca-certificates=20190108-r0 nghttp2-libs=1.35.1-r1 libssh2=1.9.0-r1 libcurl=7.64.0-r3 curl=7.64.0-r3 oniguruma=6.9.4-r0 jq=1.6-r0
---> Using cache
---> 72c50c12788d
Successfully built 72c50c12788d

change image name

I am not satisfied with my new image name, so I rename it.

1
2
3
4
5
6
7
8
root@vmnet8cloud:~/rpi# docker tag vmnet8/rpi vmnet8/base-nginx:rpi
root@vmnet8cloud:~/rpi# docker tag vmnet8/planet vmnet8/base-nginx:x86
root@vmnet8cloud:~/rpi# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
vmnet8/base-nginx rpi 758ef3313bac 9 hours ago 52MB
vmnet8/rpi latest 758ef3313bac 9 hours ago 52MB
vmnet8/planet latest 72c50c12788d 9 hours ago 20.4MB
treehouses/bettercap first fa1faf86b2e9 5 days ago 35.9MB

push image to my dockerhub repo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
root@vmnet8cloud:~/rpi# docker push  vmnet8/base-nginx:rpi
The push refers to repository [docker.io/vmnet8/base-nginx]
06f60bd1a60b: Mounted from vmnet8/rpi
2d7044011d61: Mounted from vmnet8/rpi
7772294ad95b: Mounted from vmnet8/rpi
ca20d2ade963: Mounted from vmnet8/rpi
0c8b16ac3ec0: Mounted from vmnet8/rpi
6ff0e3daf858: Mounted from vmnet8/rpi
4bc006337f97: Mounted from vmnet8/rpi
9c66fd3856dc: Mounted from vmnet8/rpi
77ffeb9e9842: Mounted from vmnet8/rpi
rpi: digest: sha256:ced17c99328babcabff78c78db75c3426c47a55aa1fec8bcdb554134327f7fff size: 2205
root@vmnet8cloud:~/rpi# docker push vmnet8/base-nginx:x86
The push refers to repository [docker.io/vmnet8/base-nginx]
dc696a4b831b: Mounted from vmnet8/planet
05652609bfdb: Mounted from vmnet8/planet
1cd1ec9f681c: Mounted from vmnet8/planet
77ffeb9e9842: Layer already exists
x86: digest: sha256:40fc08ff08e250a9022242cab5f68042c98b6e1f09551fe4dfca3b04dfcc8533 size: 1157

using manifest to create multi-arch image

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
root@vmnet8cloud:~/rpi# docker manifest create vmnet8/base-nginx:latest vmnet8/base-nginx:x86 vmnet8/base-nginx:rpi
Created manifest list docker.io/vmnet8/base-nginx:latest


root@vmnet8cloud:~/rpi# docker manifest inspect vmnet8/base-nginx
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 2205,
"digest": "sha256:ced17c99328babcabff78c78db75c3426c47a55aa1fec8bcdb554134327f7fff",
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1157,
"digest": "sha256:40fc08ff08e250a9022242cab5f68042c98b6e1f09551fe4dfca3b04dfcc8533",
"platform": {
"architecture": "arm",
"os": "linux"
}
}
]
}
root@vmnet8cloud:~/rpi# docker manifest inspect vmnet8/base-nginx
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 2205,
"digest": "sha256:ced17c99328babcabff78c78db75c3426c47a55aa1fec8bcdb554134327f7fff",
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1157,
"digest": "sha256:40fc08ff08e250a9022242cab5f68042c98b6e1f09551fe4dfca3b04dfcc8533",
"platform": {
"architecture": "arm",
"os": "linux"
}
}
]
}
root@vmnet8cloud:~/template# docker manifest push vmnet8/base-nginx:latest
sha256:9d646d372f76466948ee660cecd0100bc56dc0fe8e73e8e5294d7873ed09519c

Testing

I created an arm arch image and amd64 image. I want to test these images to see if they work well

On my rpi, I test multi-arch if it works

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
pi@treehouses:~ $ docker pull vmnet8/base-nginx
Using default tag: latest
latest: Pulling from vmnet8/base-nginx
6e39823df636: Already exists
44e31f35ea82: Pull complete
42d1b29a4b84: Pull complete
5f669d9949cf: Pull complete
Digest: sha256:9d646d372f76466948ee660cecd0100bc56dc0fe8e73e8e5294d7873ed09519c
Status: Downloaded newer image for vmnet8/base-nginx:latest
docker.io/vmnet8/base-nginx:latest
pi@treehouses:~ $ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
vmnet8/base-nginx latest 72c50c12788d 12 hours ago 20.4MB
pi@treehouses:~ $ docker inspect 72c50c12788d
[
{
"Id": "sha256:72c50c12788d9f57b40a19b83e95a9ca1d5ede10508a6b4d9db89cac67488046",
"RepoTags": [
"vmnet8/base-nginx:latest"
],
"RepoDigests": [
"vmnet8/base-nginx@sha256:9d646d372f76466948ee660cecd0100bc56dc0fe8e73e8e5294d7873ed09519c"
],
"Parent": "",
"Comment": "",
"Created": "2019-12-09T20:16:55.461030258Z",
"Container": "c6f35ed83a7ef7abb9b25b5e437156de03d18a2a1d300a2cb87e73a096ec5307",
"ContainerConfig": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.16.0",
"NJS_VERSION=0.3.1",
"PKG_RELEASE=1"
],
"Cmd": [
"/bin/sh",
"-c",
"apk add --no-cache fcgi=2.4.0-r8 fcgiwrap=1.1.0-r3 spawn-fcgi=1.6.4-r3 ca-certificates=20190108-r0 nghttp2-libs=1.35.1-r1 libssh2=1.9.0-r1 libcurl=7.64.0-r3 curl=7.64.0-r3 oniguruma=6.9.4-r0 jq=1.6-r0"
],
"Image": "sha256:f7441287619ec6a39d018a9c8a7612c719ef7f214c59a701c86734bc88d03865",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"
},
"StopSignal": "SIGTERM"
},
"DockerVersion": "19.03.5",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.16.0",
"NJS_VERSION=0.3.1",
"PKG_RELEASE=1"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"ArgsEscaped": true,
"Image": "sha256:f7441287619ec6a39d018a9c8a7612c719ef7f214c59a701c86734bc88d03865",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"
},
"StopSignal": "SIGTERM"
},
"Architecture": "arm",
"Os": "linux",
"Size": 20383390,
"VirtualSize": 20383390,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/060e14f6a1d2061d067463c07859a8d771d0e062bb830765109873f70cb6069a/diff:/var/lib/docker/overlay2/30dbadfa6d758ac43c176e04ed6ebd5a5b1774068e098823c37457904cf07f9d/diff:/var/lib/docker/overlay2/decf25251786958f57e943f099fa7095fa83a5ddbca3c89130b19373a464748f/diff",
"MergedDir": "/var/lib/docker/overlay2/58b35d0db3363fcd6dda91aef93c198be97e0f0f1cdfe32be0077b714b1e2968/merged",
"UpperDir": "/var/lib/docker/overlay2/58b35d0db3363fcd6dda91aef93c198be97e0f0f1cdfe32be0077b714b1e2968/diff",
"WorkDir": "/var/lib/docker/overlay2/58b35d0db3363fcd6dda91aef93c198be97e0f0f1cdfe32be0077b714b1e2968/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:77ffeb9e98427bfbcc3448a22e354cf57e30de34d6c516365659b851f679b1b4",
"sha256:1cd1ec9f681cc950d0100535cbd8f3e939c50ab9f9b2d14092992c5465a9f1da",
"sha256:05652609bfdb21400e2e13d494475a2e79f7427288c60d20db6756f14de59f5d",
"sha256:dc696a4b831ba0c0096808ba0fc072fe5927fe3b2f4189af12adf436be364f79"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]

it shows pull arm archtecture from dockhub.

1
2
pi@treehouses:~ $ docker run -d -p 20001:80 vmnet8/base-nginx 
8016c0ea58895053be07bc13c50a08dbe85cd01524eca608855e80b2bcffddbf

try other image

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
pi@treehouses:~ $ docker pull vmnet8/base-nginx:rpi
rpi: Pulling from vmnet8/base-nginx
6e39823df636: Already exists
38dd00ade3c1: Already exists
c02057c17ddc: Already exists
e6d776bad3ac: Already exists
92ca2fd255df: Already exists
a2cfa1cf1cbb: Already exists
35e3be655ed6: Already exists
f182036f54c2: Already exists
ebbf6799aa99: Pull complete
Digest: sha256:ced17c99328babcabff78c78db75c3426c47a55aa1fec8bcdb554134327f7fff
Status: Downloaded newer image for vmnet8/base-nginx:rpi
docker.io/vmnet8/base-nginx:rpi
pi@treehouses:~ $ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
vmnet8/base-nginx rpi 758ef3313bac 12 hours ago 52MB
vmnet8/base-nginx latest 72c50c12788d 12 hours ago 20.4MB
pi@treehouses:~ $ docker run -d -p 20002:80 vmnet8/base-nginx:rpi
8d041aecd3937332821e569e74b6744b8d1bd63f2c3b99ea7e410819b81fec0c

run this image
it shows 403 error

test on vagrant treehouse/cli

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
vagrant@cli:~$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
rabbitmq 3-management 8bdbe10dc73e 5 weeks ago 180MB
treehouses/planet latest a67c7ab86add 7 weeks ago 37.6MB
treehouses/planet local a67c7ab86add 7 weeks ago 37.6MB
treehouses/planet db-init fab533186a58 7 weeks ago 98.6MB
treehouses/planet db-init-local fab533186a58 7 weeks ago 98.6MB
treehouses/couchdb 2.3.1 7f64c92d91fb 3 months ago 201MB
vagrant@cli:~$ docker pull vmnet8/base-nginx
Using default tag: latest
latest: Pulling from vmnet8/base-nginx
6e39823df636: Pull complete
38dd00ade3c1: Pull complete
c02057c17ddc: Pull complete
e6d776bad3ac: Pull complete
92ca2fd255df: Pull complete
a2cfa1cf1cbb: Pull complete
35e3be655ed6: Pull complete
f182036f54c2: Pull complete
ebbf6799aa99: Pull complete
Digest: sha256:9d646d372f76466948ee660cecd0100bc56dc0fe8e73e8e5294d7873ed09519c
Status: Downloaded newer image for vmnet8/base-nginx:latest
docker.io/vmnet8/base-nginx:latest
vagrant@cli:~$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
vmnet8/base-nginx latest 758ef3313bac 28 hours ago 52MB
rabbitmq 3-management 8bdbe10dc73e 5 weeks ago 180MB
treehouses/planet latest a67c7ab86add 7 weeks ago 37.6MB
treehouses/planet local a67c7ab86add 7 weeks ago 37.6MB
treehouses/planet db-init fab533186a58 7 weeks ago 98.6MB
treehouses/planet db-init-local fab533186a58 7 weeks ago 98.6MB
treehouses/couchdb 2.3.1 7f64c92d91fb 3 months ago 201MB
vagrant@cli:~$ docker image inspect vmnet8/base-nginx
[
{
"Id": "sha256:758ef3313bac7fa1fda2b08abc68fa712ae778fdaa65ef5f561e75f346e921f3",
"RepoTags": [
"vmnet8/base-nginx:latest"
],
"RepoDigests": [
"vmnet8/base-nginx@sha256:9d646d372f76466948ee660cecd0100bc56dc0fe8e73e8e5294d7873ed09519c"
],
"Parent": "",
"Comment": "",
"Created": "2019-12-09T20:30:58.028636649Z",
"Container": "a6902c745dd55b102fbc0fec29545b88b0b5418b81a3aa463fe6892894bae52a",
"ContainerConfig": {
"Hostname": "bf6e13d66684",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"443/tcp": {},
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"UDEV=off",
"NGINX_VERSION=1.14"
],
"Cmd": [
"/bin/sh",
"-c",
"apk add --no-cache fcgi=2.4.0-r8 fcgiwrap=1.1.0-r3 spawn-fcgi=1.6.4-r3 ca-certificates=20190108-r0 nghttp2-libs=1.35.1-r0 libssh2=1.8.2-r0 libcurl=7.64.0-r2 curl=7.64.0-r2 oniguruma=6.9.4-r0 jq=1.6-r0"
],
"Image": "sha256:9412dc8b27c29e6114610c6abd884bb8d13b0396f800c9fed39eef921483e78c",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": [],
"Labels": {
"io.balena.architecture": "rpi",
"io.balena.device-type": "raspberry-pi",
"io.balena.qemu.version": "4.0.0+balena-arm",
"org.opencontainers.image.authors": "Tobias Hargesheimer <docker@ison.ws>",
"org.opencontainers.image.description": "AlpineLinux with NGINX on arm arch",
"org.opencontainers.image.licenses": "Apache-2.0",
"org.opencontainers.image.source": "https://github.com/Tob1asDocker/rpi-nginx",
"org.opencontainers.image.title": "NGINX",
"org.opencontainers.image.url": "https://hub.docker.com/r/tobi312/rpi-nginx/"
}
},
"DockerVersion": "19.03.5",
"Author": "",
"Config": {
"Hostname": "bf6e13d66684",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"443/tcp": {},
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"UDEV=off",
"NGINX_VERSION=1.14"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"ArgsEscaped": true,
"Image": "sha256:9412dc8b27c29e6114610c6abd884bb8d13b0396f800c9fed39eef921483e78c",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/usr/bin/entry.sh"
],
"OnBuild": [],
"Labels": {
"io.balena.architecture": "rpi",
"io.balena.device-type": "raspberry-pi",
"io.balena.qemu.version": "4.0.0+balena-arm",
"org.opencontainers.image.authors": "Tobias Hargesheimer <docker@ison.ws>",
"org.opencontainers.image.description": "AlpineLinux with NGINX on arm arch",
"org.opencontainers.image.licenses": "Apache-2.0",
"org.opencontainers.image.source": "https://github.com/Tob1asDocker/rpi-nginx",
"org.opencontainers.image.title": "NGINX",
"org.opencontainers.image.url": "https://hub.docker.com/r/tobi312/rpi-nginx/"
}
},
"Architecture": "amd64",
"Os": "linux",
"Size": 52043162,
"VirtualSize": 52043162,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/d65700181956c296d4fdad06b0eaf044450f42948c12ffe0c98369399f3a6171/diff:/var/lib/docker/overlay2/a7fb82cc01d1930806d1c39d1063f4afe95b85bd14acaf4ba5ef25e375acfcaa/diff:/var/lib/docker/overlay2/be79231a2717e7b566eb93f73e098c923310d519ba0df738e9b129e49d68309d/diff:/var/lib/docker/overlay2/85a0df8e1aee0b5a820eaea35ad4478decb1f612f76f89a58e811eb1c8cb45c5/diff:/var/lib/docker/overlay2/74bd5ba7975f879d629da5c5be5ef941598dfacc6bb696d9ac9b1e718bf43460/diff:/var/lib/docker/overlay2/723a132236875c0bbead39340a897bca76a1958e0da321bd4d5933fad0aacd92/diff:/var/lib/docker/overlay2/c6647e80ba872b63745bd7134df3ad5bd563c9723377d1d9db60bb42e14cd35c/diff:/var/lib/docker/overlay2/1bee8c0cb8bf6ace619c5c54016a0f332bf83830e3f12e401f52f88e058a7be9/diff",
"MergedDir": "/var/lib/docker/overlay2/b18c2588c00f54836210ae958ad1f10685db2304eeb97f501dbf9aeb9545084f/merged",
"UpperDir": "/var/lib/docker/overlay2/b18c2588c00f54836210ae958ad1f10685db2304eeb97f501dbf9aeb9545084f/diff",
"WorkDir": "/var/lib/docker/overlay2/b18c2588c00f54836210ae958ad1f10685db2304eeb97f501dbf9aeb9545084f/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:77ffeb9e98427bfbcc3448a22e354cf57e30de34d6c516365659b851f679b1b4",
"sha256:9c66fd3856dc997fc3aedba30803f1bd69651be0cda1757d5db959f37a7fe491",
"sha256:4bc006337f970a3226b3ab7b5d3692b90d9bb7cd18746c29be269d6ed75f347d",
"sha256:6ff0e3daf8589cf6b0e6f254f3f7d44d0955810d147bd4f87b150d794d6aa681",
"sha256:0c8b16ac3ec05312e8fc393f53fe14840a0c8408c960f75297b46ad252f17d8a",
"sha256:ca20d2ade963c426acdb97ca81df2d1b0181fc29f1b89745d582874e64c9087f",
"sha256:7772294ad95bdaa10c84d306f03bbcc74bede2cc04393114f7c821c0813a8828",
"sha256:2d7044011d61cb9fa0a42c0741341323240bb6c1ccb4741afacbb0bbdaaa3dcb",
"sha256:06f60bd1a60b1ebeebb9d569809e0282ff9ccb7a1ea235c35e66e618dd993b94"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]

docker pull the amd64 as latest version.

run this image

1
2
3
4
5
6
7
8
9
10
vagrant@cli:~$ docker run -d -p 20003:80  vmnet8/base-nginx
3a0dd81e2b75c5cf34d33cd41308f66049b072f01543bc079bfaed6246d20cfd
vagrant@cli:~$ curl localhost:20003
curl: (7) Failed to connect to localhost port 20003: Connection refused
vagrant@cli:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3a0dd81e2b75 vmnet8/base-nginx "/usr/bin/entry.sh n…" 17 seconds ago Exited (1) 15 seconds ago confident_poincare
cb31b79eff78 vmnet8/base-nginx "/usr/bin/entry.sh n…" 5 hours ago Exited (1) 5 hours ago stoic_williamson
a84339e656b4 rabbitmq:3-management "docker-entrypoint.s…" 5 weeks ago Exited (255) 5 hours ago 4369/tcp, 5671-5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:8080->15672/tcp some-rabbit
6b2ff2ae5528 treehouses/couchdb:2.3.1 "tini -- /docker-ent…" 6 weeks ago Exited (255) 5 hours ago 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp vmnet8

it shows this docker image failed to run. I build this image on Pi, which is the reason failed.

build image on x86.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
vagrant@cli:~/newbase$ docker image build -t vmnet8/base-nginx:x86new .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM nginx:1.16.0-alpine
1.16.0-alpine: Pulling from library/nginx
e7c96db7181b: Already exists
8985e402e050: Already exists
Digest: sha256:270bea203d2fc3743fb9ce0193325e188b7e6233043487e3d3cf117ea4d3f337
Status: Downloaded newer image for nginx:1.16.0-alpine
---> ef04b00b089d
Step 2/3 : RUN rm -rf /usr/share/nginx/html/*
---> Running in 26a738b05d6b
Removing intermediate container 26a738b05d6b
---> 1a3fa7c937d7
Step 3/3 : RUN apk add --no-cache fcgi=2.4.0-r8 fcgiwrap=1.1.0-r3 spawn-fcgi=1.6.4-r3 ca-certificates=20190108-r0 nghttp2-libs=1.35.1-r1 libssh2=1.9.0-r1 libcurl=7.64.0-r3 curl=7.64.0-r3 oniguruma=6.9.4-r0 jq=1.6-r0
---> Running in 487a73601a7c
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/10) Installing ca-certificates (20190108-r0)
(2/10) Installing nghttp2-libs (1.35.1-r1)
(3/10) Installing libssh2 (1.9.0-r1)
(4/10) Installing libcurl (7.64.0-r3)
(5/10) Installing curl (7.64.0-r3)
(6/10) Installing fcgi (2.4.0-r8)
(7/10) Installing fcgiwrap (1.1.0-r3)
Executing fcgiwrap-1.1.0-r3.pre-install
(8/10) Installing oniguruma (6.9.4-r0)
(9/10) Installing jq (1.6-r0)
(10/10) Installing spawn-fcgi (1.6.4-r3)
Executing busybox-1.29.3-r10.trigger
Executing ca-certificates-20190108-r0.trigger
OK: 30 MiB in 47 packages
Removing intermediate container 487a73601a7c
---> d8aec7e71b73
Successfully built d8aec7e71b73
Successfully tagged vmnet8/base-nginx:x86new
vagrant@cli:~/newbase$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
vmnet8/base-nginx x86new d8aec7e71b73 14 seconds ago 23.5MB
vmnet8/base-nginx latest 758ef3313bac 33 hours ago 52MB
rabbitmq 3-management 8bdbe10dc73e 5 weeks ago 180MB
treehouses/planet latest a67c7ab86add 7 weeks ago 37.6MB
treehouses/planet local a67c7ab86add 7 weeks ago 37.6MB
treehouses/planet db-init fab533186a58 7 weeks ago 98.6MB
treehouses/planet db-init-local fab533186a58 7 weeks ago 98.6MB
treehouses/couchdb 2.3.1 7f64c92d91fb 3 months ago 201MB
nginx 1.16.0-alpine ef04b00b089d 7 months ago 20.4MB
vagrant@cli:~/newbase$ docker image inspect vmnet8/base-nginx:x86new
[
{
"Id": "sha256:d8aec7e71b735ce78ea6e30fa22272c29206d064302b04b5265ba7abfa60250a",
"RepoTags": [
"vmnet8/base-nginx:x86new"
],
"RepoDigests": [],
"Parent": "sha256:1a3fa7c937d7f6dfa6e1353bc404f2bdecbc650de6ee68274e512dbf98698d5c",
"Comment": "",
"Created": "2019-12-11T05:41:23.768015601Z",
"Container": "487a73601a7c8890adb98c479a2b711e04b5d148b3bc8d90e5ee741034a08971",
"ContainerConfig": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.16.0",
"NJS_VERSION=0.3.1",
"PKG_RELEASE=1"
],
"Cmd": [
"/bin/sh",
"-c",
"apk add --no-cache fcgi=2.4.0-r8 fcgiwrap=1.1.0-r3 spawn-fcgi=1.6.4-r3 ca-certificates=20190108-r0 nghttp2-libs=1.35.1-r1 libssh2=1.9.0-r1 libcurl=7.64.0-r3 curl=7.64.0-r3 oniguruma=6.9.4-r0 jq=1.6-r0"
],
"Image": "sha256:1a3fa7c937d7f6dfa6e1353bc404f2bdecbc650de6ee68274e512dbf98698d5c",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"
},
"StopSignal": "SIGTERM"
},
"DockerVersion": "19.03.3",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NGINX_VERSION=1.16.0",
"NJS_VERSION=0.3.1",
"PKG_RELEASE=1"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"ArgsEscaped": true,
"Image": "sha256:1a3fa7c937d7f6dfa6e1353bc404f2bdecbc650de6ee68274e512dbf98698d5c",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"
},
"StopSignal": "SIGTERM"
},
"Architecture": "amd64",
"Os": "linux",
"Size": 23454243,
"VirtualSize": 23454243,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/5a707ebb56c473f0b857d9f3ba70210ec9e599e2c1dcff32091ff9609e97fc40/diff:/var/lib/docker/overlay2/dc6895345b17265c1e0d24dfd5e54755dd564c41f31e8e43cc53ecfa559aabdf/diff:/var/lib/docker/overlay2/75e6526fd72d6193688bb1d4f9b3eea897e2e3fc0467f1ff39e4ef94e4a9ee61/diff",
"MergedDir": "/var/lib/docker/overlay2/4c4adc9af1f46fcb4bcf1b0d90715b31302dc6b1861d34ea85191d3bd59b5fa9/merged",
"UpperDir": "/var/lib/docker/overlay2/4c4adc9af1f46fcb4bcf1b0d90715b31302dc6b1861d34ea85191d3bd59b5fa9/diff",
"WorkDir": "/var/lib/docker/overlay2/4c4adc9af1f46fcb4bcf1b0d90715b31302dc6b1861d34ea85191d3bd59b5fa9/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:f1b5933fe4b5f49bbe8258745cf396afe07e625bdab3168e364daf7c956b6b81",
"sha256:2bdf88b2699da3549a9cbc76f9b6ee058cc1f9d232fba48dda107478abfc694b",
"sha256:cc2d7d10b40de1e2253f628b1881b4e27998b82ba38f8182f4773144a30c7ca0",
"sha256:6f9350f71e829ee3a008387295156dd216e126c2248b0ce9e72a6dfdb599a6ac"
]
},
"Metadata": {
"LastTagTime": "2019-12-11T05:41:23.967401201Z"
}
}
]

I pushed this image to dockerhub

1
2
3
4
5
6
7
vagrant@cli:~/newbase$ docker push vmnet8/base-nginx:x86new
The push refers to repository [docker.io/vmnet8/base-nginx]
6f9350f71e82: Pushed
cc2d7d10b40d: Pushed
2bdf88b2699d: Mounted from library/nginx
f1b5933fe4b5: Mounted from library/nginx
x86new: digest: sha256:ec6b9bd2bdac454ab43080c163ba9e06119e0a075c5f433cbcd481398c88a013 size: 1157

I try to build multi-arch image

1
2
vagrant@cli:~/newbase$ docker manifest create vmnet8/base-nginx:latest vmnet8/base-nginx:rpi vmnet8/base-nginx:x86 vmnet8/base-nginx:x86new 
Created manifest list docker.io/vmnet8/base-nginx:latest

note: before manifest create, I need to

1
vim /home/vagrant/.docker/config.json

add

1
"experimental": "enabled"

after manifest created, I inspect it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
vagrant@cli:~/newbase$ docker manifest inspect vmnet8/base-nginx
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 2205,
"digest": "sha256:ced17c99328babcabff78c78db75c3426c47a55aa1fec8bcdb554134327f7fff",
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1157,
"digest": "sha256:40fc08ff08e250a9022242cab5f68042c98b6e1f09551fe4dfca3b04dfcc8533",
"platform": {
"architecture": "arm",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1157,
"digest": "sha256:ec6b9bd2bdac454ab43080c163ba9e06119e0a075c5f433cbcd481398c88a013",
"platform": {
"architecture": "amd64",
"os": "linux"
}
}
]
}

then push this manifest list to dockerhub

1
2
vagrant@cli:~/newbase$ docker manifest push vmnet8/base-nginx:latest
sha256:49c78057a124c4b05f90028d3d322c39e4f4b76ee2be173e6969207f7887cc77

I am going to run imaged which is created on vagrant to see if it works

1
2
3
4
5
6
7
8
9
10
vagrant@cli:~/newbase$ docker run -d -p 20003:80 vmnet8/base-nginx:x86new
9ab8b587f00d2d5df112a12acff0f1bb43ec5a99880c20566d05be83bfb81eaa
vagrant@cli:~/newbase$ curl localhost:20003
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.16.0</center>
</body>
</html>

it works!

I try to use multi-arch tag to pull docker image from dockerhub

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
vagrant@cli:~$ docker pull vmnet8/base-nginx
Using default tag: latest
latest: Pulling from vmnet8/base-nginx
6e39823df636: Pull complete
38dd00ade3c1: Pull complete
c02057c17ddc: Pull complete
e6d776bad3ac: Pull complete
92ca2fd255df: Pull complete
a2cfa1cf1cbb: Pull complete
35e3be655ed6: Pull complete
f182036f54c2: Pull complete
ebbf6799aa99: Pull complete
Digest: sha256:49c78057a124c4b05f90028d3d322c39e4f4b76ee2be173e6969207f7887cc77
Status: Downloaded newer image for vmnet8/base-nginx:latest
docker.io/vmnet8/base-nginx:latest
vagrant@cli:~$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
vmnet8/base-nginx latest 758ef3313bac 34 hours ago 52MB
rabbitmq 3-management 8bdbe10dc73e 5 weeks ago 180MB
treehouses/planet latest a67c7ab86add 7 weeks ago 37.6MB
treehouses/planet local a67c7ab86add 7 weeks ago 37.6MB
treehouses/planet db-init fab533186a58 7 weeks ago 98.6MB
treehouses/planet db-init-local fab533186a58 7 weeks ago 98.6MB
treehouses/couchdb 2.3.1 7f64c92d91fb 3 months ago 201MB
nginx 1.16.0-alpine ef04b00b089d 7 months ago 20.4MB
vagrant@cli:~$ docker run -d -p 20004:80 vmnet8/base-nginx
a89bcd5de4cc0f891df5a07d86d0a0424f72c307924ed814a87fb84110441a13
vagrant@cli:~$ curl localhost:20004
curl: (7) Failed to connect to localhost port 20004: Connection refused
vagrant@cli:~$ docker image inspect vmnet8/base-nginx
[
{
"Id": "sha256:758ef3313bac7fa1fda2b08abc68fa712ae778fdaa65ef5f561e75f346e921f3",
"RepoTags": [
"vmnet8/base-nginx:latest"
],
"RepoDigests": [
"vmnet8/base-nginx@sha256:49c78057a124c4b05f90028d3d322c39e4f4b76ee2be173e6969207f7887cc77"
],
"Parent": "",
"Comment": "",
"Created": "2019-12-09T20:30:58.028636649Z",
"Container": "a6902c745dd55b102fbc0fec29545b88b0b5418b81a3aa463fe6892894bae52a",
"ContainerConfig": {
"Hostname": "bf6e13d66684",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"443/tcp": {},
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"UDEV=off",
"NGINX_VERSION=1.14"
],
"Cmd": [
"/bin/sh",
"-c",
"apk add --no-cache fcgi=2.4.0-r8 fcgiwrap=1.1.0-r3 spawn-fcgi=1.6.4-r3 ca-certificates=20190108-r0 nghttp2-libs=1.35.1-r0 libssh2=1.8.2-r0 libcurl=7.64.0-r2 curl=7.64.0-r2 oniguruma=6.9.4-r0 jq=1.6-r0"
],
"Image": "sha256:9412dc8b27c29e6114610c6abd884bb8d13b0396f800c9fed39eef921483e78c",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": [],
"Labels": {
"io.balena.architecture": "rpi",
"io.balena.device-type": "raspberry-pi",
"io.balena.qemu.version": "4.0.0+balena-arm",
"org.opencontainers.image.authors": "Tobias Hargesheimer <docker@ison.ws>",
"org.opencontainers.image.description": "AlpineLinux with NGINX on arm arch",
"org.opencontainers.image.licenses": "Apache-2.0",
"org.opencontainers.image.source": "https://github.com/Tob1asDocker/rpi-nginx",
"org.opencontainers.image.title": "NGINX",
"org.opencontainers.image.url": "https://hub.docker.com/r/tobi312/rpi-nginx/"
}
},
"DockerVersion": "19.03.5",
"Author": "",
"Config": {
"Hostname": "bf6e13d66684",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"443/tcp": {},
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"UDEV=off",
"NGINX_VERSION=1.14"
],
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"ArgsEscaped": true,
"Image": "sha256:9412dc8b27c29e6114610c6abd884bb8d13b0396f800c9fed39eef921483e78c",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/usr/bin/entry.sh"
],
"OnBuild": [],
"Labels": {
"io.balena.architecture": "rpi",
"io.balena.device-type": "raspberry-pi",
"io.balena.qemu.version": "4.0.0+balena-arm",
"org.opencontainers.image.authors": "Tobias Hargesheimer <docker@ison.ws>",
"org.opencontainers.image.description": "AlpineLinux with NGINX on arm arch",
"org.opencontainers.image.licenses": "Apache-2.0",
"org.opencontainers.image.source": "https://github.com/Tob1asDocker/rpi-nginx",
"org.opencontainers.image.title": "NGINX",
"org.opencontainers.image.url": "https://hub.docker.com/r/tobi312/rpi-nginx/"
}
},
"Architecture": "amd64",
"Os": "linux",
"Size": 52043162,
"VirtualSize": 52043162,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/70cc3e3fca1507e7c9211d22d66265395f885288b1d399fd003514537556386b/diff:/var/lib/docker/overlay2/ab42b343ec4b7c5aa9e0ba0f481ace9ae691ad10afdf36f1c314b230342f9924/diff:/var/lib/docker/overlay2/7e603a7ebe90bb63e84dd3501b14ba46c0616240f7c52aaa47197b9e3c804f33/diff:/var/lib/docker/overlay2/b8dd6469e761a22a9dfe53b5289a90b779b4fbdf26fcb1dd26756611d81a64ef/diff:/var/lib/docker/overlay2/3fc0c51f817104f7fca2a82f0802196eb6a57a8cf4decc787c52b99fd54f4b7c/diff:/var/lib/docker/overlay2/b89a682e4c598baceee669bf3fdefc299975da996e6d0013a5090c301aeae075/diff:/var/lib/docker/overlay2/bf6fd4d2a150b622243975d715f0e33e556071b13c6484fe7fe5917b08b71481/diff:/var/lib/docker/overlay2/fd3f10fb826ce429ce564d9df304dd67ef3ddb51ad6f8c25997d56db45705e5c/diff",
"MergedDir": "/var/lib/docker/overlay2/7fde1119a0359c349ce4626798034f5bfe595f5137996b86d7604e9f0547f4ee/merged",
"UpperDir": "/var/lib/docker/overlay2/7fde1119a0359c349ce4626798034f5bfe595f5137996b86d7604e9f0547f4ee/diff",
"WorkDir": "/var/lib/docker/overlay2/7fde1119a0359c349ce4626798034f5bfe595f5137996b86d7604e9f0547f4ee/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:77ffeb9e98427bfbcc3448a22e354cf57e30de34d6c516365659b851f679b1b4",
"sha256:9c66fd3856dc997fc3aedba30803f1bd69651be0cda1757d5db959f37a7fe491",
"sha256:4bc006337f970a3226b3ab7b5d3692b90d9bb7cd18746c29be269d6ed75f347d",
"sha256:6ff0e3daf8589cf6b0e6f254f3f7d44d0955810d147bd4f87b150d794d6aa681",
"sha256:0c8b16ac3ec05312e8fc393f53fe14840a0c8408c960f75297b46ad252f17d8a",
"sha256:ca20d2ade963c426acdb97ca81df2d1b0181fc29f1b89745d582874e64c9087f",
"sha256:7772294ad95bdaa10c84d306f03bbcc74bede2cc04393114f7c821c0813a8828",
"sha256:2d7044011d61cb9fa0a42c0741341323240bb6c1ccb4741afacbb0bbdaaa3dcb",
"sha256:06f60bd1a60b1ebeebb9d569809e0282ff9ccb7a1ea235c35e66e618dd993b94"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]

it still failed, but I don’t know which tag this image is

Make directory for bettercap and build docker image under this diretory, not recommend under root.
Clone the dockerfile from github,
Note: git clone the whole git repo, otherwise build process will failed because of lacking some files such as makefile.

1
git clone https://github.com/bettercap/bettercap.git

build the docker image

Note: it needs at least 4G memory. I used the Pi 3B+, which only has 1G memory, it failed. then I changed to Pi4.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
root@vmnet8cloud:~/bettercap/bettercap# docker build .
Sending build context to Docker daemon 19.83MB
Step 1/17 : FROM golang:alpine AS build-env
---> 6a83a6459979
Step 2/17 : ENV SRC_DIR $GOPATH/src/github.com/bettercap/bettercap
---> Running in f7be9c390ea2
Removing intermediate container f7be9c390ea2
---> 574512a28fc9
Step 3/17 : RUN apk add --update ca-certificates
---> Running in b93f2b7777b8
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/armv7/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/armv7/APKINDEX.tar.gz
OK: 4 MiB in 15 packages
Removing intermediate container b93f2b7777b8
---> 6a02504d09c8
Step 4/17 : RUN apk add --no-cache --update bash iptables wireless-tools build-base libpcap-dev libusb-dev linux-headers libnetfilter_queue-dev git
---> Running in 504d45657d66
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/armv7/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/armv7/APKINDEX.tar.gz
(1/42) Installing ncurses-terminfo-base (6.1_p20190518-r0)
(2/42) Installing ncurses-terminfo (6.1_p20190518-r0)
(3/42) Installing ncurses-libs (6.1_p20190518-r0)
(4/42) Installing readline (8.0.0-r0)
(5/42) Installing bash (5.0.0-r0)
Executing bash-5.0.0-r0.post-install
(6/42) Installing binutils (2.32-r0)
(7/42) Installing libmagic (5.37-r1)
(8/42) Installing file (5.37-r1)
(9/42) Installing gmp (6.1.2-r1)
(10/42) Installing isl (0.18-r0)
(11/42) Installing libgomp (8.3.0-r0)
(12/42) Installing libatomic (8.3.0-r0)
(13/42) Installing libgcc (8.3.0-r0)
(14/42) Installing mpfr3 (3.1.5-r1)
(15/42) Installing mpc1 (1.1.0-r0)
(16/42) Installing libstdc++ (8.3.0-r0)
(17/42) Installing gcc (8.3.0-r0)
(18/42) Installing musl-dev (1.1.22-r3)
(19/42) Installing libc-dev (0.7.1-r0)
(20/42) Installing g++ (8.3.0-r0)
(21/42) Installing make (4.2.1-r2)
(22/42) Installing fortify-headers (1.1-r0)
(23/42) Installing build-base (0.5-r1)
(24/42) Installing nghttp2-libs (1.39.2-r0)
(25/42) Installing libcurl (7.66.0-r0)
(26/42) Installing expat (2.2.8-r0)
(27/42) Installing pcre2 (10.33-r0)
(28/42) Installing git (2.22.0-r0)
(29/42) Installing libmnl (1.0.4-r0)
(30/42) Installing libnftnl-libs (1.1.3-r0)
(31/42) Installing iptables (1.8.3-r0)
(32/42) Installing libnfnetlink (1.0.1-r1)
(33/42) Installing libnetfilter_queue (1.0.3-r0)
(34/42) Installing pkgconf (1.6.1-r1)
(35/42) Installing libnfnetlink-dev (1.0.1-r1)
(36/42) Installing libnetfilter_queue-dev (1.0.3-r0)
(37/42) Installing libpcap (1.9.1-r0)
(38/42) Installing libpcap-dev (1.9.1-r0)
(39/42) Installing libusb (1.0.22-r0)
(40/42) Installing libusb-dev (1.0.22-r0)
(41/42) Installing linux-headers (4.19.36-r0)
(42/42) Installing wireless-tools (30_pre9-r1)
Executing busybox-1.30.1-r2.trigger
OK: 144 MiB in 57 packages
Removing intermediate container 504d45657d66
---> f648d787ff0e
Step 5/17 : WORKDIR $SRC_DIR
---> Running in e14fcfed0d87
Removing intermediate container e14fcfed0d87
---> 181d2b3b343f
Step 6/17 : ADD . $SRC_DIR
---> 4461303d94d7
Step 7/17 : RUN make
---> Running in 1faa1d85eb96
go build -o bettercap .
go: downloading github.com/evilsocket/islazy v1.10.4
go: downloading github.com/dustin/go-humanize v1.0.0
go: downloading github.com/bettercap/readline v0.0.0-20180208083827-9cec905dd291
go: downloading github.com/google/gopacket v1.1.17
go: downloading github.com/jpillora/go-tld v0.0.0-20190202073305-f16ca3b7b383
go: extracting github.com/dustin/go-humanize v1.0.0
go: downloading github.com/gobwas/glob v0.0.0-20181002190808-e7a84e9525fe
go: extracting github.com/evilsocket/islazy v1.10.4
go: extracting github.com/bettercap/readline v0.0.0-20180208083827-9cec905dd291
go: downloading github.com/malfunkt/iprange v0.9.0
go: downloading github.com/antchfx/jsonquery v1.0.0
go: downloading github.com/miekg/dns v1.1.22
go: downloading github.com/bettercap/nrf24 v0.0.0-20190219153547-aa37e6d0e0eb
go: downloading github.com/google/gousb v0.0.0-20190812193832-18f4c1d8a750
go: extracting github.com/antchfx/jsonquery v1.0.0
go: extracting github.com/malfunkt/iprange v0.9.0
go: extracting github.com/jpillora/go-tld v0.0.0-20190202073305-f16ca3b7b383
go: extracting github.com/bettercap/nrf24 v0.0.0-20190219153547-aa37e6d0e0eb
go: extracting github.com/gobwas/glob v0.0.0-20181002190808-e7a84e9525fe
go: downloading github.com/pkg/errors v0.8.1
go: downloading github.com/inconshreveable/go-vhost v0.0.0-20160627193104-06d84117953b
go: downloading github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d
go: downloading github.com/antchfx/xpath v1.1.0
go: downloading github.com/bettercap/recording v0.0.0-20190408083647-3ce1dcf032e3
go: extracting github.com/miekg/dns v1.1.22
go: extracting github.com/google/gousb v0.0.0-20190812193832-18f4c1d8a750
go: extracting github.com/pkg/errors v0.8.1
go: extracting github.com/inconshreveable/go-vhost v0.0.0-20160627193104-06d84117953b
go: downloading github.com/google/go-github v17.0.0+incompatible
go: downloading github.com/gorilla/websocket v1.4.1
go: extracting github.com/antchfx/xpath v1.1.0
go: extracting github.com/bettercap/recording v0.0.0-20190408083647-3ce1dcf032e3
go: downloading github.com/gorilla/mux v1.7.3
go: extracting github.com/gorilla/websocket v1.4.1
go: downloading github.com/bettercap/gatt v0.0.0-20191018133023-569d3d9372bb
go: extracting github.com/google/gopacket v1.1.17
go: downloading golang.org/x/net v0.0.0-20191014212845-da9a3fd4c582
go: extracting github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d
go: extracting github.com/gorilla/mux v1.7.3
go: downloading github.com/adrianmo/go-nmea v1.1.0
go: downloading github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
go: extracting github.com/google/go-github v17.0.0+incompatible
go: extracting github.com/bettercap/gatt v0.0.0-20191018133023-569d3d9372bb
go: downloading golang.org/x/sys v0.0.0-20191018095205-727590c5006e
go: downloading github.com/kr/binarydist v0.1.0
go: downloading github.com/mdlayher/dhcp6 v0.0.0-20190311162359-2a67805d7d0b
go: extracting github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
go: extracting github.com/adrianmo/go-nmea v1.1.0
go: extracting github.com/kr/binarydist v0.1.0
go: downloading github.com/hashicorp/mdns v1.0.1
go: downloading github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484
go: downloading golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
go: downloading gopkg.in/sourcemap.v1 v1.0.5
go: extracting github.com/mdlayher/dhcp6 v0.0.0-20190311162359-2a67805d7d0b
go: downloading github.com/google/go-querystring v1.0.0
go: downloading github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab
go: extracting github.com/hashicorp/mdns v1.0.1
go: extracting gopkg.in/sourcemap.v1 v1.0.5
go: extracting github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: extracting github.com/google/go-querystring v1.0.0
go: extracting golang.org/x/net v0.0.0-20191014212845-da9a3fd4c582
go: extracting github.com/mitchellh/go-homedir v1.1.0
go: extracting github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab
go: downloading github.com/mattn/go-isatty v0.0.10
go: downloading github.com/mattn/go-colorable v0.1.4
go: downloading github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
go: extracting github.com/mattn/go-isatty v0.0.10
go: extracting github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
go: extracting github.com/mattn/go-colorable v0.1.4
go: extracting golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
go: extracting golang.org/x/sys v0.0.0-20191018095205-727590c5006e
go: finding github.com/evilsocket/islazy v1.10.4
go: finding github.com/malfunkt/iprange v0.9.0
go: finding github.com/dustin/go-humanize v1.0.0
go: finding github.com/mitchellh/go-homedir v1.1.0
go: finding github.com/adrianmo/go-nmea v1.1.0
go: finding github.com/bettercap/readline v0.0.0-20180208083827-9cec905dd291
go: finding github.com/bettercap/gatt v0.0.0-20191018133023-569d3d9372bb
go: finding github.com/bettercap/recording v0.0.0-20190408083647-3ce1dcf032e3
go: finding github.com/gorilla/mux v1.7.3
go: finding github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab
go: finding github.com/google/gopacket v1.1.17
go: finding github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
go: finding github.com/gorilla/websocket v1.4.1
go: finding github.com/antchfx/jsonquery v1.0.0
go: finding github.com/mattn/go-colorable v0.1.4
go: finding github.com/gobwas/glob v0.0.0-20181002190808-e7a84e9525fe
go: finding github.com/bettercap/nrf24 v0.0.0-20190219153547-aa37e6d0e0eb
go: finding github.com/mdlayher/dhcp6 v0.0.0-20190311162359-2a67805d7d0b
go: finding github.com/pkg/errors v0.8.1
go: finding github.com/mattn/go-isatty v0.0.10
go: finding github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d
go: finding golang.org/x/sys v0.0.0-20191018095205-727590c5006e
go: finding github.com/google/gousb v0.0.0-20190812193832-18f4c1d8a750
go: finding github.com/kr/binarydist v0.1.0
go: finding github.com/antchfx/xpath v1.1.0
go: finding github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
go: finding github.com/hashicorp/mdns v1.0.1
go: finding github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484
go: finding github.com/miekg/dns v1.1.22
go: finding github.com/google/go-github v17.0.0+incompatible
go: finding golang.org/x/net v0.0.0-20191014212845-da9a3fd4c582
go: finding gopkg.in/sourcemap.v1 v1.0.5
go: finding github.com/inconshreveable/go-vhost v0.0.0-20160627193104-06d84117953b
go: finding github.com/jpillora/go-tld v0.0.0-20190202073305-f16ca3b7b383
go: finding github.com/google/go-querystring v1.0.0
go: finding golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
Removing intermediate container 1faa1d85eb96
---> b3d614b2ec69
Step 8/17 : RUN mkdir -p /usr/local/share/bettercap
---> Running in 14eb7daf4ff8
Removing intermediate container 14eb7daf4ff8
---> 68727ce1be68
Step 9/17 : RUN git clone https://github.com/bettercap/caplets /usr/local/share/bettercap/caplets
---> Running in be1c4c4a54cc
Cloning into '/usr/local/share/bettercap/caplets'...
Removing intermediate container be1c4c4a54cc
---> 2c4f0fa1e524
Step 10/17 : FROM alpine
latest: Pulling from library/alpine
99fc70ac0b64: Already exists
Digest: sha256:c19173c5ada610a5989151111163d28a67368362762534d8a8121ce95cf2bd5a
Status: Downloaded newer image for alpine:latest
---> 27560c0c9c97
Step 11/17 : RUN apk add --update ca-certificates
---> Running in 509fe0867c6d
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/armv7/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/armv7/APKINDEX.tar.gz
(1/1) Installing ca-certificates (20190108-r0)
Executing busybox-1.30.1-r2.trigger
Executing ca-certificates-20190108-r0.trigger
OK: 4 MiB in 15 packages
Removing intermediate container 509fe0867c6d
---> 9293f9271587
Step 12/17 : RUN apk add --no-cache --update bash iproute2 libpcap libusb-dev libnetfilter_queue wireless-tools
---> Running in 65daa4f9d22b
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/armv7/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/armv7/APKINDEX.tar.gz
(1/16) Installing ncurses-terminfo-base (6.1_p20190518-r0)
(2/16) Installing ncurses-terminfo (6.1_p20190518-r0)
(3/16) Installing ncurses-libs (6.1_p20190518-r0)
(4/16) Installing readline (8.0.0-r0)
(5/16) Installing bash (5.0.0-r0)
Executing bash-5.0.0-r0.post-install
(6/16) Installing libmnl (1.0.4-r0)
(7/16) Installing libnftnl-libs (1.1.3-r0)
(8/16) Installing iptables (1.8.3-r0)
(9/16) Installing iproute2 (4.20.0-r1)
Executing iproute2-4.20.0-r1.post-install
(10/16) Installing libnfnetlink (1.0.1-r1)
(11/16) Installing libnetfilter_queue (1.0.3-r0)
(12/16) Installing libpcap (1.9.1-r0)
(13/16) Installing libusb (1.0.22-r0)
(14/16) Installing pkgconf (1.6.1-r1)
(15/16) Installing libusb-dev (1.0.22-r0)
(16/16) Installing wireless-tools (30_pre9-r1)
Executing busybox-1.30.1-r2.trigger
OK: 16 MiB in 31 packages
Removing intermediate container 65daa4f9d22b
---> de5bed4329f4
Step 13/17 : COPY --from=build-env /go/src/github.com/bettercap/bettercap/bettercap /app/
---> 7509d206b9bb
Step 14/17 : COPY --from=build-env /usr/local/share/bettercap/caplets /app/
---> 867af90533b0
Step 15/17 : WORKDIR /app
---> Running in e6badf626501
Removing intermediate container e6badf626501
---> c8d068058c77
Step 16/17 : EXPOSE 80 443 53 5300 8080 8081 8082 8083 8000
---> Running in dee9fe5c9c12
Removing intermediate container dee9fe5c9c12
---> e09ab03d9632
Step 17/17 : ENTRYPOINT ["/app/bettercap"]
---> Running in 056b18a9cf33
Removing intermediate container 056b18a9cf33
---> fa1faf86b2e9
Successfully built fa1faf86b2e9

it shows I successfully build an image.

Read more »

install on raspberry Pi3B+

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
root@treehouses:~# sudo apt update
Hit:1 https://download.docker.com/linux/raspbian stretch InRelease
Get:2 http://archive.raspberrypi.org/debian buster InRelease [25.2 kB]
Hit:3 https://deb.nodesource.com/node_10.x buster InRelease
Get:4 http://deb.torproject.org/torproject.org buster InRelease [4,964 B]
Get:5 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Get:6 https://packages.cloud.google.com/apt coral-cloud-stable InRelease [6,328 B]
Get:7 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB]
Get:8 http://archive.raspberrypi.org/debian buster/main armhf Packages [259 kB]
Ign:9 https://packages.cloud.google.com/apt coral-cloud-stable/main armhf Packages
Get:9 https://packages.cloud.google.com/apt coral-cloud-stable/main armhf Packages [3,358 B]
Fetched 13.3 MB in 25s (539 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
53 packages can be upgraded. Run 'apt list --upgradable' to see them.

next

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
root@treehouses:~# sudo apt install golang git build-essential libpcap-dev libusb-1.0-0-dev libnetfilter-queue-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.6).
git is already the newest version (1:2.20.1-2).
The following package was automatically installed and is no longer required:
point-rpi
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
golang-1.11 golang-1.11-doc golang-1.11-go golang-1.11-src golang-doc golang-go golang-src libnfnetlink-dev libpcap0.8-dev libusb-1.0-doc
Suggested packages:
bzr | brz mercurial subversion
The following NEW packages will be installed:
golang golang-1.11 golang-1.11-doc golang-1.11-go golang-1.11-src golang-doc golang-go golang-src libnetfilter-queue-dev libnfnetlink-dev
libpcap-dev libpcap0.8-dev libusb-1.0-0-dev libusb-1.0-doc
0 upgraded, 14 newly installed, 0 to remove and 53 not upgraded.
Need to get 52.4 MB of archives.
After this operation, 260 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-1.11-src armhf 1.11.6-1+rpi1+deb10u2 [13.0 MB]
Get:2 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-1.11-go armhf 1.11.6-1+rpi1+deb10u2 [36.3 MB]
Get:3 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-1.11-doc all 1.11.6-1+rpi1+deb10u2 [2,517 kB]
Get:4 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-1.11 all 1.11.6-1+rpi1+deb10u2 [24.1 kB]
Get:5 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-src armhf 2:1.11~1+b6 [4,660 B]
Get:6 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-go armhf 2:1.11~1+b6 [23.7 kB]
Get:7 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang-doc all 2:1.11~1 [4,392 B]
Get:8 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf golang armhf 2:1.11~1+b6 [4,612 B]
Get:9 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libnfnetlink-dev armhf 1.0.1-3 [7,928 B]
Get:10 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libnetfilter-queue-dev armhf 1.0.3-1 [6,548 B]
Get:11 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libpcap0.8-dev armhf 1.8.1-6 [220 kB]
Get:12 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libpcap-dev armhf 1.8.1-6 [25.9 kB]
Get:13 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libusb-1.0-0-dev armhf 2:1.0.22-2 [65.5 kB]
Get:14 http://mirrors.ocf.berkeley.edu/raspbian/raspbian buster/main armhf libusb-1.0-doc all 2:1.0.22-2 [182 kB]
Fetched 52.4 MB in 23s (2,250 kB/s)
Selecting previously unselected package golang-1.11-src.
(Reading database ... 154643 files and directories currently installed.)
Preparing to unpack .../00-golang-1.11-src_1.11.6-1+rpi1+deb10u2_armhf.deb ...
Unpacking golang-1.11-src (1.11.6-1+rpi1+deb10u2) ...
Selecting previously unselected package golang-1.11-go.
Preparing to unpack .../01-golang-1.11-go_1.11.6-1+rpi1+deb10u2_armhf.deb ...
Unpacking golang-1.11-go (1.11.6-1+rpi1+deb10u2) ...
Selecting previously unselected package golang-1.11-doc.
Preparing to unpack .../02-golang-1.11-doc_1.11.6-1+rpi1+deb10u2_all.deb ...
Unpacking golang-1.11-doc (1.11.6-1+rpi1+deb10u2) ...
Selecting previously unselected package golang-1.11.
Preparing to unpack .../03-golang-1.11_1.11.6-1+rpi1+deb10u2_all.deb ...
Unpacking golang-1.11 (1.11.6-1+rpi1+deb10u2) ...
Selecting previously unselected package golang-src.
Preparing to unpack .../04-golang-src_2%3a1.11~1+b6_armhf.deb ...
Unpacking golang-src (2:1.11~1+b6) ...
Selecting previously unselected package golang-go.
Preparing to unpack .../05-golang-go_2%3a1.11~1+b6_armhf.deb ...
Unpacking golang-go (2:1.11~1+b6) ...
Selecting previously unselected package golang-doc.
Preparing to unpack .../06-golang-doc_2%3a1.11~1_all.deb ...
Unpacking golang-doc (2:1.11~1) ...
Selecting previously unselected package golang.
Preparing to unpack .../07-golang_2%3a1.11~1+b6_armhf.deb ...
Unpacking golang (2:1.11~1+b6) ...
Selecting previously unselected package libnfnetlink-dev.
Preparing to unpack .../08-libnfnetlink-dev_1.0.1-3_armhf.deb ...
Unpacking libnfnetlink-dev (1.0.1-3) ...
Selecting previously unselected package libnetfilter-queue-dev.
Preparing to unpack .../09-libnetfilter-queue-dev_1.0.3-1_armhf.deb ...
Unpacking libnetfilter-queue-dev (1.0.3-1) ...
Selecting previously unselected package libpcap0.8-dev:armhf.
Preparing to unpack .../10-libpcap0.8-dev_1.8.1-6_armhf.deb ...
Unpacking libpcap0.8-dev:armhf (1.8.1-6) ...
Selecting previously unselected package libpcap-dev:armhf.
Preparing to unpack .../11-libpcap-dev_1.8.1-6_armhf.deb ...
Unpacking libpcap-dev:armhf (1.8.1-6) ...
Selecting previously unselected package libusb-1.0-0-dev:armhf.
Preparing to unpack .../12-libusb-1.0-0-dev_2%3a1.0.22-2_armhf.deb ...
Unpacking libusb-1.0-0-dev:armhf (2:1.0.22-2) ...
Selecting previously unselected package libusb-1.0-doc.
Preparing to unpack .../13-libusb-1.0-doc_2%3a1.0.22-2_all.deb ...
Unpacking libusb-1.0-doc (2:1.0.22-2) ...
Setting up libnfnetlink-dev (1.0.1-3) ...
Setting up golang-1.11-src (1.11.6-1+rpi1+deb10u2) ...
Setting up libpcap0.8-dev:armhf (1.8.1-6) ...
Setting up libusb-1.0-doc (2:1.0.22-2) ...
Setting up libusb-1.0-0-dev:armhf (2:1.0.22-2) ...
Setting up golang-1.11-go (1.11.6-1+rpi1+deb10u2) ...
Setting up libnetfilter-queue-dev (1.0.3-1) ...
Setting up golang-src (2:1.11~1+b6) ...
Setting up libpcap-dev:armhf (1.8.1-6) ...
Setting up golang-1.11-doc (1.11.6-1+rpi1+deb10u2) ...
Setting up golang-go (2:1.11~1+b6) ...
Setting up golang-1.11 (1.11.6-1+rpi1+deb10u2) ...
Setting up golang-doc (2:1.11~1) ...
Setting up golang (2:1.11~1+b6) ...
Processing triggers for man-db (2.8.5-2) ...

next

1
root@treehouses:~# go get -u github.com/bettercap/bettercap

Once the build process is concluded, the binary will be located in go/bin/bettercap
I checked the go/bin/bettercap

1
2
root@treehouses:~# which go/bin/bettercap
go/bin/bettercap
Read more »

install on Ubuntu

copy the shell script to install bettercap, then chmod +x, then run it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
anna@ubuntu1804:~$ ./bettercap.sh 
--2019-11-20 19:48:44-- https://github.com/bettercap/bettercap/releases/download/v2.26/bettercap_linux_amd64_v2.26.zip
Resolving github.com (github.com)... 192.30.255.113
Connecting to github.com (github.com)|192.30.255.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/116576783/09ae2a00-f1be-11e9-9887-8cb5e818dc9b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191121%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191121T034844Z&X-Amz-Expires=300&X-Amz-Signature=622884cd807d933374563a875deaf3f0c5dd00788d6324e5b4fc5e07cc724198&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dbettercap_linux_amd64_v2.26.zip&response-content-type=application%2Foctet-stream [following]
--2019-11-20 19:48:44-- https://github-production-release-asset-2e65be.s3.amazonaws.com/116576783/09ae2a00-f1be-11e9-9887-8cb5e818dc9b?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191121%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191121T034844Z&X-Amz-Expires=300&X-Amz-Signature=622884cd807d933374563a875deaf3f0c5dd00788d6324e5b4fc5e07cc724198&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dbettercap_linux_amd64_v2.26.zip&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.25.140
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.25.140|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14037021 (13M) [application/octet-stream]
Saving to: ‘bettercap_linux_amd64_v2.26.zip’

bettercap_linux_amd64_v2.26.zip 100%[=================================================================>] 13.39M 1.39MB/s in 9.9s

2019-11-20 19:48:55 (1.35 MB/s) - ‘bettercap_linux_amd64_v2.26.zip’ saved [14037021/14037021]

Archive: bettercap_linux_amd64_v2.26.zip
inflating: bettercap
inflating: bettercap_linux_amd64_v2.26.sha256
[sudo] password for anna:


bettercap: error while loading shared libraries: libnetfilter_queue.so.1: cannot open shared object file: No such file or directory

It shows something wrong during installation, so I try the last command

1
2
anna@ubuntu1804:~$ sudo bettercap -eval "caplets.update; ui.update; quit"
bettercap: error while loading shared libraries: libnetfilter_queue.so.1: cannot open shared object file: No such file or directory

It shows I need to install libnetfilter-queue1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
anna@ubuntu1804:~$ sudo apt install libnetfilter-queue1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libnetfilter-queue1
0 upgraded, 1 newly installed, 0 to remove and 35 not upgraded.
Need to get 11.4 kB of archives.
After this operation, 61.4 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 libnetfilter-queue1 amd64 1.0.2-2 [11.4 kB]
Fetched 11.4 kB in 0s (42.2 kB/s)
Selecting previously unselected package libnetfilter-queue1.
(Reading database ... 219919 files and directories currently installed.)
Preparing to unpack .../libnetfilter-queue1_1.0.2-2_amd64.deb ...
Unpacking libnetfilter-queue1 (1.0.2-2) ...
Setting up libnetfilter-queue1 (1.0.2-2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Read more »