Configuring a Docker image












1















I'm trying to build a Dockerfile. But after executing I get this error:



Sending build context to Docker daemon  31.08MB
Step 1/5 : FROM davidrazd/discord-node-10
---> 0ad384ff6003
Step 2/5 : RUN apt-get update
---> Running in 9fb4313d8011
Reading package lists...
W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
The command '/bin/sh -c apt-get update' returned a non-zero code: 100


I also tried to put sudo in the dockerfile to make sure I have full access as root.



Dockerfile:



# Start writing your Dockerfile easily
FROM davidrazd/discord-node-10

RUN sudo apt-get update
RUN sudo apt-get install -y python-pip
RUN sudo install --upgrade pip









share|improve this question





























    1















    I'm trying to build a Dockerfile. But after executing I get this error:



    Sending build context to Docker daemon  31.08MB
    Step 1/5 : FROM davidrazd/discord-node-10
    ---> 0ad384ff6003
    Step 2/5 : RUN apt-get update
    ---> Running in 9fb4313d8011
    Reading package lists...
    W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
    E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
    E: Unable to lock directory /var/lib/apt/lists/
    The command '/bin/sh -c apt-get update' returned a non-zero code: 100


    I also tried to put sudo in the dockerfile to make sure I have full access as root.



    Dockerfile:



    # Start writing your Dockerfile easily
    FROM davidrazd/discord-node-10

    RUN sudo apt-get update
    RUN sudo apt-get install -y python-pip
    RUN sudo install --upgrade pip









    share|improve this question



























      1












      1








      1








      I'm trying to build a Dockerfile. But after executing I get this error:



      Sending build context to Docker daemon  31.08MB
      Step 1/5 : FROM davidrazd/discord-node-10
      ---> 0ad384ff6003
      Step 2/5 : RUN apt-get update
      ---> Running in 9fb4313d8011
      Reading package lists...
      W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
      E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
      E: Unable to lock directory /var/lib/apt/lists/
      The command '/bin/sh -c apt-get update' returned a non-zero code: 100


      I also tried to put sudo in the dockerfile to make sure I have full access as root.



      Dockerfile:



      # Start writing your Dockerfile easily
      FROM davidrazd/discord-node-10

      RUN sudo apt-get update
      RUN sudo apt-get install -y python-pip
      RUN sudo install --upgrade pip









      share|improve this question
















      I'm trying to build a Dockerfile. But after executing I get this error:



      Sending build context to Docker daemon  31.08MB
      Step 1/5 : FROM davidrazd/discord-node-10
      ---> 0ad384ff6003
      Step 2/5 : RUN apt-get update
      ---> Running in 9fb4313d8011
      Reading package lists...
      W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
      E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
      E: Unable to lock directory /var/lib/apt/lists/
      The command '/bin/sh -c apt-get update' returned a non-zero code: 100


      I also tried to put sudo in the dockerfile to make sure I have full access as root.



      Dockerfile:



      # Start writing your Dockerfile easily
      FROM davidrazd/discord-node-10

      RUN sudo apt-get update
      RUN sudo apt-get install -y python-pip
      RUN sudo install --upgrade pip






      images docker






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 6 at 15:04







      Jack

















      asked Jan 6 at 13:06









      JackJack

      62




      62






















          1 Answer
          1






          active

          oldest

          votes


















          1














          The image you imported includes a user specification:



          USER container


          The apt-get update and apt-get install command require root access. Within a docker build, you get root access by running your container commands as root, rather than performing a sudo. Therefore, your dockerfile would look like:



          # Start writing your Dockerfile easily
          FROM davidrazd/discord-node-10
          USER root
          RUN apt-get update
          && apt-get install -y python-pip
          && install --upgrade pip
          USER container


          I'd recommend reading the following before getting much further into writing your Dockerfiles since there are other issues you'll want to resolve with the apt-get commands (chaining commands, removing input from config, not installing recommended packages, and cleaning up after the install commands): https://docs.docker.com/develop/develop-images/dockerfile_best-practices/






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            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%2fsuperuser.com%2fquestions%2f1391156%2fconfiguring-a-docker-image%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









            1














            The image you imported includes a user specification:



            USER container


            The apt-get update and apt-get install command require root access. Within a docker build, you get root access by running your container commands as root, rather than performing a sudo. Therefore, your dockerfile would look like:



            # Start writing your Dockerfile easily
            FROM davidrazd/discord-node-10
            USER root
            RUN apt-get update
            && apt-get install -y python-pip
            && install --upgrade pip
            USER container


            I'd recommend reading the following before getting much further into writing your Dockerfiles since there are other issues you'll want to resolve with the apt-get commands (chaining commands, removing input from config, not installing recommended packages, and cleaning up after the install commands): https://docs.docker.com/develop/develop-images/dockerfile_best-practices/






            share|improve this answer




























              1














              The image you imported includes a user specification:



              USER container


              The apt-get update and apt-get install command require root access. Within a docker build, you get root access by running your container commands as root, rather than performing a sudo. Therefore, your dockerfile would look like:



              # Start writing your Dockerfile easily
              FROM davidrazd/discord-node-10
              USER root
              RUN apt-get update
              && apt-get install -y python-pip
              && install --upgrade pip
              USER container


              I'd recommend reading the following before getting much further into writing your Dockerfiles since there are other issues you'll want to resolve with the apt-get commands (chaining commands, removing input from config, not installing recommended packages, and cleaning up after the install commands): https://docs.docker.com/develop/develop-images/dockerfile_best-practices/






              share|improve this answer


























                1












                1








                1







                The image you imported includes a user specification:



                USER container


                The apt-get update and apt-get install command require root access. Within a docker build, you get root access by running your container commands as root, rather than performing a sudo. Therefore, your dockerfile would look like:



                # Start writing your Dockerfile easily
                FROM davidrazd/discord-node-10
                USER root
                RUN apt-get update
                && apt-get install -y python-pip
                && install --upgrade pip
                USER container


                I'd recommend reading the following before getting much further into writing your Dockerfiles since there are other issues you'll want to resolve with the apt-get commands (chaining commands, removing input from config, not installing recommended packages, and cleaning up after the install commands): https://docs.docker.com/develop/develop-images/dockerfile_best-practices/






                share|improve this answer













                The image you imported includes a user specification:



                USER container


                The apt-get update and apt-get install command require root access. Within a docker build, you get root access by running your container commands as root, rather than performing a sudo. Therefore, your dockerfile would look like:



                # Start writing your Dockerfile easily
                FROM davidrazd/discord-node-10
                USER root
                RUN apt-get update
                && apt-get install -y python-pip
                && install --upgrade pip
                USER container


                I'd recommend reading the following before getting much further into writing your Dockerfiles since there are other issues you'll want to resolve with the apt-get commands (chaining commands, removing input from config, not installing recommended packages, and cleaning up after the install commands): https://docs.docker.com/develop/develop-images/dockerfile_best-practices/







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 8 at 1:15









                BMitchBMitch

                1785




                1785






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • 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%2fsuperuser.com%2fquestions%2f1391156%2fconfiguring-a-docker-image%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

                    Plaza Victoria

                    In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                    How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...