Closed devashish2203 closed 3 weeks ago
IN order to run Telepresence in an alpine container, you'll need the following:
RUN apk add --no-cache ca-certificates iptables iptables-legacy bash
RUN rm /sbin/iptables && ln -s /sbin/iptables-legacy /sbin/iptables
RUN rm /sbin/ip6tables && ln -s /sbin/ip6tables-legacy /sbin/ip6tables
Not sure about alpine:3.14 though. The current version is 3.20.
In general, I'd suggest using telepresence connect --docker
to start the telepresence daemon container and then telepresence intercept --docker-run
to start containers that reuses the network established by that daemon.
Thanks. I'll try out on the latest alpine and the above additional dependencies and report back.
For the other suggestion regarding telepresence connect --docker
. My end goal is to run telepresence on a docker runner in Gitlab CI, so not sure if the daemon container method would work there.
Seeing the same issue with alpine:3.20 and the above added dependency. My dockerFile now is
# Dockerfile with telepresence and its prerequisites
FROM alpine:3.20
# Install Telepresence prerequisites
RUN apk add --no-cache curl ca-certificates iptables iptables-legacy bash sshfs iproute2
RUN rm /sbin/iptables && ln -s /sbin/iptables-legacy /sbin/iptables
RUN rm /sbin/ip6tables && ln -s /sbin/ip6tables-legacy /sbin/ip6tables
# Download and install the telepresence binary
USER root
RUN curl -fL https://app.getambassador.io/download/tel2oss/releases/download/v2.18.0/telepresence-linux-amd64 -o telepresence
RUN chmod +x ./telepresence
And then I am running
> docker build . -t telepresence-cli
> docker run --network=host --cap-add=NET_ADMIN --device /dev/net/tun:/dev/net/tun -it --rm telepresence-cli
Inside the container
/ # ./telepresence
/bin/sh: ./telepresence: not found
/ # ./telepresence version
/bin/sh: ./telepresence: not found
Using an Ubuntu 22.04 base container I was able to run telepresence. My Dockerfile below.
# Dockerfile with telepresence and its prerequisites
FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install -y curl ca-certificates sshfs
# Download and install the telepresence binary
RUN curl -fL https://app.getambassador.io/download/tel2oss/releases/download/v2.18.0/telepresence-linux-amd64 -o telepresence
RUN chmod +x ./telepresence
Ah, yes. The alpine image doesn't contain the same libc. You need to add this:
RUN apk add libc6-compat
You'll see what the binary needs by doing:
ldd ./telepresence
Good info about this in the first reply to this Stack Overflow question.
Thank you for the pointers. The stack overflow link is particularly helpful to understand what was going on. Closing this issue now.
Describe the bug
I am trying to setup telepresence inside a docker container to run on CI. But when running the telepresence binary I get the following error
To Reproduce For this I setup a simple Docker image using the following Dockerfile based on https://github.com/telepresenceio/telepresence.io/blob/master/docs/pre-release/reference/inside-container.md#running-the-container
Dockerfile
Then I'm building the container on an Ubuntu 22.04 machine
Next I'm running the above container using
Once inside the container when trying to run telepresence
The following error is shown
Expected behavior Expect to see the following output
Versions (please complete the following information):
telepresence version
- Unable to run command, Downloading the v2.18.0 binary.telepresence
commandsVPN-related bugs: N/A
Additional context The same version of the teleport binary works fine on the host Ubunut machine
In a different docker image where the base image is Ubuntu 22.04 instead of alpine, a similar error is seen