Open waldekmastykarz opened 2 years ago
Any updates on this?
Not at the moment. Would you prefer to use Dev Proxy inside a Docker container rather than having it on the host?
Yes that would be ideal for our setup. I tried running it from a docker container myself but I can't get it to work yet. When running devproxy
it starts a process but I'm not getting any output and the proxy is not working.
Got it. Could you please share with us your Dockerfile and some more information about how you've been trying to use Dev Proxy (OS setup, type of app, etc.)?
I'm trying to mock responses from the Microsoft Graph API.
Dockerfile
FROM amd64/ubuntu:focal
WORKDIR /src
RUN apt -y update
RUN apt -y upgrade
RUN apt install -y \
curl \
unzip
COPY install.sh ./
RUN chmod +x ./install.sh
ENTRYPOINT [ "./install.sh" ]
install.sh
#!/bin/bash
/bin/bash -c "$(curl -sL https://aka.ms/devproxy/setup.sh)"
source ~/.bashrc
# Prevents error "Couldn't find a valid ICU package" when running devproxy
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
# TODO: Binary is not available in path for some reason so we need to specify use the binary location
./devproxy/devproxy
Thanks! Is Dev Proxy running (I can see you're launching it at the end but want to double check it's working)? Is the app calling Microsoft Graph in the same Docker container as Dev Proxy or another (or on your host)?
dev proxy is running, as in I can cntrl+c my way out of it. But it does not give any output so it seems like its stuck at startup. If I run the example curl command to call the proxy from inside the container I get a ‘connection refused’ error.
Eventually I’ll want to call the app from outside of the container, in which case I’ll need to expose the port or setup a network. But for now I’d like to just get a basic working version inside a docker container.
Thanks for the quick responses btw!
Cool, thanks for all the information. Let me see if I can replicate this and I'll get back to you
It's working for me just fine. Here's what I've done:
docker run --rm -it devproxy
(the process ends with Dev Proxy running)docker exec -it e65 bash
(e65
is my conainer's name)curl -ikx http://127.0.0.1:8000 https://jsonplaceholder.typicode.com/posts
which is intercepted by Dev ProxyThe default Dev Proxy config file is setup to intercept requests to https://jsonplaceholder.typicode.com/*
. If you want to intercept calls to Microsoft Graph, you can use the Microsoft 365 specific preset, like devproxy --config-file ~appFolder/presets/m365.json
Hope this helps!
This is not working on my machine (macbook M2). I'm trying exactly what you've done, with the only difference being that I add --platform linux/amd64
at the end of the docker run
command. I'm guessing its an issue with me being on a macbook.
I'm curious what the last output of your container is. Mine looks like
Dev Proxy v0.16.1 installed!
To get started, run:
source ~/.bashrc
devproxy -h
Is your install.sh
file ending with ./devproxy/devproxy
as you shared above?
For me, the output ends with Dev Proxy running (information about the IP address and the port it's using).
I've got an M2 MBAir so can try it there too
Yes my install script ends with running devproxy. I’m also not getting any output when running devproxy after manually logging in to the container. The curl to the proxy is not working.
Let me see if I can repro that on my M2
I can repro your issue on my M2: basically Dev Proxy is stuck starting when ran in Docker on an M2. Let's take it up as a separate issue that we'll investigate. Thanks for bringing it up
Hey @LucDrenth, I found a solution. Check out #639 for more info.
Also, I updated the base image to arm64v8/ubuntu:focal
to avoid the warning about incompatible architecture.
To further simplify acquisition, we’ll publish the proxy as a Docker container so that customers can pull it from Docker hub without having to run custom executables on their host. This allows them to isolate the runtime but also have a shared instance of the proxy running for the whole dev team.