Giter Club home page Giter Club logo

Comments (5)

anibali avatar anibali commented on August 22, 2024

Since you have not posted the error message, the image you're using, or any other information, I'm not sure what your exact problem is. However, you do need to run sudo apt-get update before installing things. Did you do this?

from docker-pytorch.

alexfarhang avatar alexfarhang commented on August 22, 2024

I am having a similar error. After running sudo apt-get update, I get the following error:
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set.

Is there some kind of step I should be doing before this? Might this be related to adding and switching to the non-root user? I am running docker container in singularity after converting it to a singularity image.

from docker-pytorch.

anibali avatar anibali commented on August 22, 2024

@alexfarhang It could be a problem with whatever singularity is doing (I don't know what it is and certainly haven't tested with it). I can install software in a running container just fine:

aiden@aiden-ubuntu:~$ docker run --rm -it anibali/pytorch:1.8.1-cuda11.1-ubuntu20.04 bash
user@41031d5b9b38:/app$ sudo apt-get update
Ign:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
[...]
Fetched 17.9 MB in 7s (2598 kB/s)                                              
Reading package lists... Done
user@41031d5b9b38:/app$ sudo apt-get install cowsay
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libtext-charwidth-perl
Suggested packages:
  filters cowsay-off
The following NEW packages will be installed:
  cowsay libtext-charwidth-perl
0 upgraded, 2 newly installed, 0 to remove and 11 not upgraded.
Need to get 28.4 kB of archives.
After this operation, 135 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libtext-charwidth-perl amd64 0.04-10 [9872 B]
Get:2 http://archive.ubuntu.com/ubuntu focal/universe amd64 cowsay all 3.03+dfsg2-7 [18.5 kB]
Fetched 28.4 kB in 1s (30.8 kB/s)  
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libtext-charwidth-perl.
(Reading database ... 8251 files and directories currently installed.)
Preparing to unpack .../libtext-charwidth-perl_0.04-10_amd64.deb ...
Unpacking libtext-charwidth-perl (0.04-10) ...
Selecting previously unselected package cowsay.
Preparing to unpack .../cowsay_3.03+dfsg2-7_all.deb ...
Unpacking cowsay (3.03+dfsg2-7) ...
Setting up libtext-charwidth-perl (0.04-10) ...
Setting up cowsay (3.03+dfsg2-7) ...
user@41031d5b9b38:/app$ /usr/games/cowsay 'Installing software works'
 ___________________________
< Installing software works >
 ---------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
user@41031d5b9b38:/app$ 

from docker-pytorch.

alexfarhang avatar alexfarhang commented on August 22, 2024

Thanks for the quick response. Yes, I think that's the case. What is the purpose of the of this block in the docker file:

# Create a non-root user and switch to it RUN adduser --disabled-password --gecos '' --shell /bin/bash user \ && chown -R user:user /app RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user USER user

from docker-pytorch.

anibali avatar anibali commented on August 22, 2024

It sets the image up so that when you run a container you will not be root inside the container, providing a small amount of safety. For example, if you don't do this and then you mount a volume on the host you will be able to create/modify/delete files owned by root on the host from inside the container.

from docker-pytorch.

Related Issues (20)

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.