Ask Your Question
1

How can you generate a docker image by using an internal nuget that is reachable through an internal network path?

asked 2021-08-25 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-11-15 04:00:00 +0000

ladyg gravatar image

To generate a Docker image by using an internal NuGet package that is reachable through an internal network path, follow these steps:

  1. Create a Dockerfile that includes the necessary steps to install and configure your NuGet client. For example, you might use the following code snippet:
FROM microsoft/dotnet:2.2-sdk
WORKDIR /app
COPY . .
RUN dotnet tool install --global NuGet.CommandLine
ENV PATH="${PATH}:/root/.dotnet/tools"
  1. Add a RUN command to your Dockerfile that uses the nuget CLI to restore your packages from your internal NuGet feed. For example:
RUN nuget sources add -name MyNuGetFeed -source \\server\path\to\feed
RUN nuget restore MyProject.csproj -Source MyNuGetFeed
  1. Continue building your Docker image by adding any additional steps necessary to configure your application and its dependencies.

  2. Build your Docker image using the docker build command. Make sure you are running the command in a context that has access to your internal network path.

docker build -t my-image .
  1. Optionally, you can also store your Docker image in a Docker registry for easier distribution and deployment. You can use a private registry that is accessible over your internal network or a public registry like Docker Hub. To push your image to a registry, use the docker push command.
docker push my-registry/my-image

Overall, the key steps for generating a Docker image using an internal NuGet package that is reachable through an internal network path are to configure your NuGet client, restore your packages from your internal feed, and then continue building your Docker image as usual.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-08-25 11:00:00 +0000

Seen: 10 times

Last updated: Nov 15 '22