Slow network when running docker container on azure devops agent

Hey,

I’m currently trying to learn docker and have started by moving our integration tests into a container. It don’t do alot but simple move the dlls to a container:

FROM mcr.microsoft.com/dotnet/sdk:3.1.408-focal

RUN apt-get update && apt-get install -y libgdiplus

WORKDIR /app
COPY ./Tests .

# run tests on docker run
ENTRYPOINT ["dotnet", "test", "Test.dll", "--logger", "trx", "--results-directory", "TestResult", "--filter"]

I have also created a docker compose file:

version: "3.4"

services:

  Test:
    image: urlToImage
    container_name: test
    command: "${filter} --verbosity n"
    environment:
      - testEnvironment=${testEnvironment}      
      - TZ=Europe/Stockholm 

So I can now run this docker container from azure devops (on an ubuntu agent) but the problem is that all network calls are really slow. The run time between in and outside docker is currently 10-15 min and it seems to be because all the network calls take 2-3 seconds more to perform.

Is there some way to fix this? I have tried to add network_mode: host but it doesn’t seems to make any difference. So I feel that I currently don’t have enough experience with docker to say why the difference are that big.

Hi millebo,

It sounds like you’re experiencing slow network calls when running your Docker container on an Azure DevOps agent. This could be due to a number of factors, including network latency or bandwidth constraints.

One thing you could try is using a Docker volume to cache dependencies and avoid unnecessary network calls. This can improve performance and reduce the time it takes to build and run your container.

Additionally, you may want to consider optimizing your Dockerfile and docker-compose.yml files to minimize resource usage and improve performance. This could involve reducing the number of layers in your Dockerfile, using multi-stage builds, or configuring your Docker network settings more efficiently.

Finally, if you’re interested in DevOps certification, there are several options available depending on your specific interests and skill level. Some popular certifications include the Microsoft Certified: Azure DevOps Engineer Expert certification, the AWS Certified DevOps Engineer certification, and the Google Cloud DevOps Engineer certification. These certifications can help you demonstrate your expertise in DevOps practices and technologies, and can be a valuable addition to your resume.

I hope this helps, and good luck with your Docker and DevOps journey!