Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update base ubuntu to 22.04 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ Try bpftrace in macOS

1. Install Docker Desktop for Mac
2. ./build.sh
Ideally check the version of bpftrace included in the ubuntu distribution and run the build with the same version for the compatibility of the tools
```
# BPFTRACE_VERSION=v0.14.0 ./build.sh
```
3. ./run.sh
Docker arguments can be passed like this
```
# ./run.sh -v /Users/home:/Users/home -e KUBECONFIG=${KUBECONFIG}
```
4. Enjoy!

![demo](https://user-images.githubusercontent.com/186170/99377060-1b09be80-2909-11eb-8c73-e9064dfc7f15.gif)
Expand Down
23 changes: 18 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
ARG KERNEL_VERSION

FROM linuxkit/kernel:${KERNEL_VERSION} as ksrc
FROM ubuntu:20.04 AS build
FROM ubuntu:22.04 AS build

ARG BPFTRACE_VERSION

SHELL ["/bin/bash", "-c"]

WORKDIR /kernel
COPY --from=ksrc /kernel-dev.tar .
RUN tar xf kernel-dev.tar

WORKDIR /work
RUN apt-get update && apt-get install -y \
wget vim tmux git binutils unzip && \
wget https://github.com/iovisor/bpftrace/releases/download/${BPFTRACE_VERSION}/bpftrace && \
chmod +x bpftrace && \
mv bpftrace /bin && \
wget vim tmux git binutils unzip bpftrace lsb-release gnupg curl && \
mkdir -p /playground/tetris && \
wget https://github.com/iovisor/bpftrace/archive/${BPFTRACE_VERSION}.zip && \
unzip ${BPFTRACE_VERSION}.zip && \
Expand All @@ -23,6 +22,20 @@ RUN apt-get update && apt-get install -y \
cp bpftrace-tetris/tetris.bt /playground/tetris/ && \
mv /kernel/usr/src/linux-headers* /kernel/usr/src/linux-headers

RUN echo -e "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse \n\
deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse \n\
deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" \n\
> /etc/apt/sources.list.d/ddebs.list && \
apt install ubuntu-dbgsym-keyring && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F2EDC64DC5AEE1F6B9C621F0C8CAB6595FDFF622 && \
apt update && \
apt install bpftrace-dbgsym

RUN curl -fsSLo /etc/apt/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list && \
apt update && \
apt install -y kubectl

ENV BPFTRACE_KERNEL_SOURCE=/kernel/usr/src/linux-headers

COPY setup.sh .
Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

KERNEL_VERSION=`docker run --rm -it alpine uname -r | cut -d'-' -f1`

docker run --privileged --rm -it bpftrace_mac:${KERNEL_VERSION}
docker run --privileged --rm -it ${@} bpftrace_mac:${KERNEL_VERSION}