Giter Site home page Giter Site logo

dotnetcore-docker-mods's Introduction

About this Repo

Recently, I was trying to develop .NET Core applications in Linux environment without installing its runtime and SDK. I've used the guidelines in the official repository. It works good, but there is a subtle problem when you need to save directory or files generated from container into the host: file permissions.

.NET Core official images run as root user so all generated files belong to "root:root". Therefore, when you try to modify any of the created files in the host you get a "permission denied" message (see issue 271). In the case you want to have full control of created files in the host you must run the container with the same user you want to be the real owner.

One may find --user option in docker run command a valid choice to solve this problem, but if the user entered isn't registered in the container, it won't work. Check below:

Docker run image

the images described in this repository assure the user and group exist in the .NET core SDK container.

Previous readings and requirements

You should read the guidelines in the repository for .NET Core Docker images. Particularly, you should understand the development model described in Develop .NET Core Applications in a Container.

Image List

Usage

The Dockerfiles in this repo relies on build-time variables as parameters to determine the user in the container.

You should build a custom image passing the "arg-variables" URS, UID, GRP and GID.

docker build --build-arg USR=$(id -nu) --build-arg UID=$(id -u) --build-arg GRP=$(id -ng) --build-arg GID=$(id -g) -t my-dotnetcore-sdk -f Dockerfile-dotnetcore-sdk .

Thereafter, you can use the new image just like the following example:

docker run --rm -v ~/devel/apis:/home/$(id -nu) my-dotnetcore-sdk dotnet new webapi -o MyApi

dotnetcore-docker-mods's People

Contributors

michelav avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.