Dockerfile, groupadd with GUI parameter












3















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.










share|improve this question

























  • 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
















3















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.










share|improve this question

























  • 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














3












3








3








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 22:20







someuser1

















asked Nov 25 '18 at 22:11









someuser1someuser1

717




717













  • 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



















  • 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

















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












1 Answer
1






active

oldest

votes


















0














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.



enter image description here



You may build as docker build -t pydebug1 . as well.






share|improve this answer

























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    0














    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.



    enter image description here



    You may build as docker build -t pydebug1 . as well.






    share|improve this answer






























      0














      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.



      enter image description here



      You may build as docker build -t pydebug1 . as well.






      share|improve this answer




























        0












        0








        0







        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.



        enter image description here



        You may build as docker build -t pydebug1 . as well.






        share|improve this answer















        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.



        enter image description here



        You may build as docker build -t pydebug1 . as well.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 27 '18 at 3:45

























        answered Nov 26 '18 at 17:08









        Robert RanjanRobert Ranjan

        363410




        363410
































            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Costa Masnaga

            Fotorealismo

            Sidney Franklin