-
Notifications
You must be signed in to change notification settings - Fork 23
Add user to generated docker image #35
base: master
Are you sure you want to change the base?
Conversation
@electronix can you have a look? I think this should be separate from the dockerhub stream because of the incompatibility. But then we need to update tutorials in the book |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works fine if you build the docker image yourself (why do you need this?). This does not work anymore if you provide the docker image for general purpose or use it on a different machine as the GUID will change.
For fixing the file permissions, look at the cleanup section of https://www.substratee.com/howto_private_tx.html
The following command mounts the current directory into docker and publishes the default ports of the binaries to the host: | ||
|
||
``` | ||
docker run -it --mount "type=bind,src=$(pwd),dst=/opt/shared" --workdir /opt/shared -p 9979:9944 -p 2079:2000 -p 3079:3443 scssubstratee/substratee_dev:1804-2.12-1.1.3-001-user-1000-group-1000 /bin/bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name of the docker image may be wrong. your user and group can have a different guid
docker run -it --mount "type=bind,src=$(pwd),dst=/opt/shared" --workdir /opt/shared -p 9979:9944 -p 2079:2000 -p 3079:3443 scssubstratee/substratee_dev:1804-2.12-1.1.3-001-user-1000-group-1000 /bin/bash | ||
``` | ||
|
||
Pre-built docker images are also available on [docker hub](https://hub.docker.com/repository/docker/scssubstratee/substratee_dev/tags). **Note:** The pre-built images will always run as root. Any files generated withing docker can only be changed with root access. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the last sentence is not correct. Please have a look at the cleanup section on howto_private_tx on substratee.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ups. I have never seen this section. What about files that are modified by both, like the Cargo.lock? And after subsequent builds. Do we need to return the ownership after every build inside the docker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you just need to return ownership before exiting the docker container. root can anyhow write your (local) files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I see that, but my scenario is that I am developping while running the container.
…ing the build and adds the user to the generated docker image. The docker is started by default with that user's USER_ID and GROUP_ID. This fixes the permission issues for docker generated files. **Note: ** the build needs to be executed locally to work.
The docker_build.sh script takes into account the current user executing the build and adds the user to the generated docker image. The docker is started by default with that user's USER_ID and GROUP_ID.
This fixes the permission issues for docker generated files on the host system.
Note: the build needs to be executed locally to work. This will not work for the images on dockerhub