Dockerfile, groupadd with GUI parameter
I am trying to add group with id declared in dockerfile, however I always get error:
groups: cannot find name for group ID 1001
My dockerfile:
FROM python:3.7.1
ARG UID=1001
RUN apt-get update && apt-get install -y openssh-server sudo
RUN mkdir /var/run/sshd
RUN echo 'root:pycharm' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed 's@sessions*requireds*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
RUN groupadd -r charm -g 1001
RUN useradd -ms /bin/bash charm -g charm -u 1001
RUN echo "export VISIBLE=now" >> /etc/profile
ADD helpers /opt/.pycharm_helpers
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
Error message I get when I try to enter container with:
docker exec -ti -u 1001 pydebug1 bash
Group doesn't exists in /etc/group
file. When I run commands inside container then works but I want to have them inside Dockerfile.
docker ubuntu dockerfile
|
show 2 more comments
I am trying to add group with id declared in dockerfile, however I always get error:
groups: cannot find name for group ID 1001
My dockerfile:
FROM python:3.7.1
ARG UID=1001
RUN apt-get update && apt-get install -y openssh-server sudo
RUN mkdir /var/run/sshd
RUN echo 'root:pycharm' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed 's@sessions*requireds*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
RUN groupadd -r charm -g 1001
RUN useradd -ms /bin/bash charm -g charm -u 1001
RUN echo "export VISIBLE=now" >> /etc/profile
ADD helpers /opt/.pycharm_helpers
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
Error message I get when I try to enter container with:
docker exec -ti -u 1001 pydebug1 bash
Group doesn't exists in /etc/group
file. When I run commands inside container then works but I want to have them inside Dockerfile.
docker ubuntu dockerfile
Have you tried running something likedocker run -it -u 1001 <container-name> /bin/bash -c 'grep 1001 /etc/group'
?. It seems your problem is unrelated to info you provided
– agg3l
Nov 25 '18 at 23:18
I've tried it in mac, built image by touching local file 'helpers'. Built image successfully and I can enter into the image without any issues. Please re-try.
– Robert Ranjan
Nov 26 '18 at 4:24
@agg3l there is no group with that id when I do your command
– someuser1
Nov 26 '18 at 8:48
@RobertRanjan did you enter the container successfully withdocker exec -ti -u 1001 pydebug1 bash
command?
– someuser1
Nov 26 '18 at 8:49
Yes except the image name. I used the commit hash of image I built. What command did you use to built? did you see any error messages while you build it?
– Robert Ranjan
Nov 26 '18 at 16:45
|
show 2 more comments
I am trying to add group with id declared in dockerfile, however I always get error:
groups: cannot find name for group ID 1001
My dockerfile:
FROM python:3.7.1
ARG UID=1001
RUN apt-get update && apt-get install -y openssh-server sudo
RUN mkdir /var/run/sshd
RUN echo 'root:pycharm' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed 's@sessions*requireds*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
RUN groupadd -r charm -g 1001
RUN useradd -ms /bin/bash charm -g charm -u 1001
RUN echo "export VISIBLE=now" >> /etc/profile
ADD helpers /opt/.pycharm_helpers
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
Error message I get when I try to enter container with:
docker exec -ti -u 1001 pydebug1 bash
Group doesn't exists in /etc/group
file. When I run commands inside container then works but I want to have them inside Dockerfile.
docker ubuntu dockerfile
I am trying to add group with id declared in dockerfile, however I always get error:
groups: cannot find name for group ID 1001
My dockerfile:
FROM python:3.7.1
ARG UID=1001
RUN apt-get update && apt-get install -y openssh-server sudo
RUN mkdir /var/run/sshd
RUN echo 'root:pycharm' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed 's@sessions*requireds*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
RUN groupadd -r charm -g 1001
RUN useradd -ms /bin/bash charm -g charm -u 1001
RUN echo "export VISIBLE=now" >> /etc/profile
ADD helpers /opt/.pycharm_helpers
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
Error message I get when I try to enter container with:
docker exec -ti -u 1001 pydebug1 bash
Group doesn't exists in /etc/group
file. When I run commands inside container then works but I want to have them inside Dockerfile.
docker ubuntu dockerfile
docker ubuntu dockerfile
edited Nov 25 '18 at 22:20
someuser1
asked Nov 25 '18 at 22:11
someuser1someuser1
717
717
Have you tried running something likedocker run -it -u 1001 <container-name> /bin/bash -c 'grep 1001 /etc/group'
?. It seems your problem is unrelated to info you provided
– agg3l
Nov 25 '18 at 23:18
I've tried it in mac, built image by touching local file 'helpers'. Built image successfully and I can enter into the image without any issues. Please re-try.
– Robert Ranjan
Nov 26 '18 at 4:24
@agg3l there is no group with that id when I do your command
– someuser1
Nov 26 '18 at 8:48
@RobertRanjan did you enter the container successfully withdocker exec -ti -u 1001 pydebug1 bash
command?
– someuser1
Nov 26 '18 at 8:49
Yes except the image name. I used the commit hash of image I built. What command did you use to built? did you see any error messages while you build it?
– Robert Ranjan
Nov 26 '18 at 16:45
|
show 2 more comments
Have you tried running something likedocker run -it -u 1001 <container-name> /bin/bash -c 'grep 1001 /etc/group'
?. It seems your problem is unrelated to info you provided
– agg3l
Nov 25 '18 at 23:18
I've tried it in mac, built image by touching local file 'helpers'. Built image successfully and I can enter into the image without any issues. Please re-try.
– Robert Ranjan
Nov 26 '18 at 4:24
@agg3l there is no group with that id when I do your command
– someuser1
Nov 26 '18 at 8:48
@RobertRanjan did you enter the container successfully withdocker exec -ti -u 1001 pydebug1 bash
command?
– someuser1
Nov 26 '18 at 8:49
Yes except the image name. I used the commit hash of image I built. What command did you use to built? did you see any error messages while you build it?
– Robert Ranjan
Nov 26 '18 at 16:45
Have you tried running something like
docker run -it -u 1001 <container-name> /bin/bash -c 'grep 1001 /etc/group'
?. It seems your problem is unrelated to info you provided– agg3l
Nov 25 '18 at 23:18
Have you tried running something like
docker run -it -u 1001 <container-name> /bin/bash -c 'grep 1001 /etc/group'
?. It seems your problem is unrelated to info you provided– agg3l
Nov 25 '18 at 23:18
I've tried it in mac, built image by touching local file 'helpers'. Built image successfully and I can enter into the image without any issues. Please re-try.
– Robert Ranjan
Nov 26 '18 at 4:24
I've tried it in mac, built image by touching local file 'helpers'. Built image successfully and I can enter into the image without any issues. Please re-try.
– Robert Ranjan
Nov 26 '18 at 4:24
@agg3l there is no group with that id when I do your command
– someuser1
Nov 26 '18 at 8:48
@agg3l there is no group with that id when I do your command
– someuser1
Nov 26 '18 at 8:48
@RobertRanjan did you enter the container successfully with
docker exec -ti -u 1001 pydebug1 bash
command?– someuser1
Nov 26 '18 at 8:49
@RobertRanjan did you enter the container successfully with
docker exec -ti -u 1001 pydebug1 bash
command?– someuser1
Nov 26 '18 at 8:49
Yes except the image name. I used the commit hash of image I built. What command did you use to built? did you see any error messages while you build it?
– Robert Ranjan
Nov 26 '18 at 16:45
Yes except the image name. I used the commit hash of image I built. What command did you use to built? did you see any error messages while you build it?
– Robert Ranjan
Nov 26 '18 at 16:45
|
show 2 more comments
1 Answer
1
active
oldest
votes
Saved your dockerfile content in Dockerfile and touched a file with name helpers
.
Then build the image and enter into the image. Screen shot shows 2nd build, commit hash etc and id
from the image. You can see all the commands in screen shot.
You may build as docker build -t pydebug1 .
as well.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53472517%2fdockerfile-groupadd-with-gui-parameter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Saved your dockerfile content in Dockerfile and touched a file with name helpers
.
Then build the image and enter into the image. Screen shot shows 2nd build, commit hash etc and id
from the image. You can see all the commands in screen shot.
You may build as docker build -t pydebug1 .
as well.
add a comment |
Saved your dockerfile content in Dockerfile and touched a file with name helpers
.
Then build the image and enter into the image. Screen shot shows 2nd build, commit hash etc and id
from the image. You can see all the commands in screen shot.
You may build as docker build -t pydebug1 .
as well.
add a comment |
Saved your dockerfile content in Dockerfile and touched a file with name helpers
.
Then build the image and enter into the image. Screen shot shows 2nd build, commit hash etc and id
from the image. You can see all the commands in screen shot.
You may build as docker build -t pydebug1 .
as well.
Saved your dockerfile content in Dockerfile and touched a file with name helpers
.
Then build the image and enter into the image. Screen shot shows 2nd build, commit hash etc and id
from the image. You can see all the commands in screen shot.
You may build as docker build -t pydebug1 .
as well.
edited Nov 27 '18 at 3:45
answered Nov 26 '18 at 17:08
Robert RanjanRobert Ranjan
363410
363410
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53472517%2fdockerfile-groupadd-with-gui-parameter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried running something like
docker run -it -u 1001 <container-name> /bin/bash -c 'grep 1001 /etc/group'
?. It seems your problem is unrelated to info you provided– agg3l
Nov 25 '18 at 23:18
I've tried it in mac, built image by touching local file 'helpers'. Built image successfully and I can enter into the image without any issues. Please re-try.
– Robert Ranjan
Nov 26 '18 at 4:24
@agg3l there is no group with that id when I do your command
– someuser1
Nov 26 '18 at 8:48
@RobertRanjan did you enter the container successfully with
docker exec -ti -u 1001 pydebug1 bash
command?– someuser1
Nov 26 '18 at 8:49
Yes except the image name. I used the commit hash of image I built. What command did you use to built? did you see any error messages while you build it?
– Robert Ranjan
Nov 26 '18 at 16:45