Comments (15)
Indeed -- you should be able to get sudo
back by adding something simple like:
RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/*
from docker-brew-ubuntu-core.
I have containerized an existing environment that usually runs natively. It uses sudo and I am not in control of those scripts. I believe this would be a very common scenario for container usage.
As I noted, this isn't a huge issue for me but it seems like it would be really crappy if you had many containers that all specified an unqualified "FROM ubuntu" and now they didn't work. I guess the rule is to never use an undecorated FROM image if you don't control it.
I reported it mainly because it seemed like it might have been an oversight, and that there may be a number of other "missing" packages other than 'sudo'.
Sounds like it is behaving as planned, if not as I expected :-)
from docker-brew-ubuntu-core.
This was a change provided by Canonical (sudo
being no longer part of their "minimal set of packages" which they're still willing to call "Ubuntu"). Additionally, using sudo
inside a container is a bit strange in itself -- can you explain a little more what you're using it for, and why it's necessary?
As a side note, I'd highly recommend not relying on :latest
-- that alias is going to change at every LTS here, and even more frequently for other repos, so it's not going to be a stable target for repeatable builds. 😅
from docker-brew-ubuntu-core.
I wanted to note that we hit a similar problem: we use nc
for demos, so having it disappear from the docker run ubuntu
"simplest possible example" is inconvenient.
Docker have the same situation at https://docs.docker.com/engine/quickstart/#bind-a-service-on-a-tcp-port. While pinning to a specific version does give a way out, pinning to an ancient version (12.10 in that case) is worrying, and any version one pins to today will become ancient over time.
Is there a suitable alternative for "mainstream docker image that can be relied on to contain a bunch of standard Unix tools" ? Maybe we should create ubuntu-fullfat
?
from docker-brew-ubuntu-core.
If you're looking for hyper-fat images, you probably want the main variants of buildpack-deps
(https://hub.docker.com/_/buildpack-deps/, https://github.com/docker-library/buildpack-deps) -- it has both Debian and Ubuntu variations with a very large number of packages installed (three variants each: curl
, scm
, and the full libraries variant).
If they don't have nc
already as a transitive dependency (which needs to be verified), I'd be +1 to adding it under similar justifications to procps
(docker-library/buildpack-deps#38).
from docker-brew-ubuntu-core.
Aha! Thanks for the suggestion.
$ docker run -ti buildpack-deps
root@b2bd59e85828:/# nc
bash: nc: command not found
I have to say, even if this were not the case, I'd probably blanch at the 610MB download.
"Be careful what you ask for" 😃
from docker-brew-ubuntu-core.
from docker-brew-ubuntu-core.
Just to close out my detour, I note another command we use in demos - ping
- has also disappeared; my needs are nothing like a "source code management dependency" so I will not be proposing to add them to xenial-scm
.
from docker-brew-ubuntu-core.
@bboreham, the debian
image has ping. 😄
from docker-brew-ubuntu-core.
Given that this is by-design, I'm closing. 👍
from docker-brew-ubuntu-core.
@tianon This is userful for me ,thank you .
from docker-brew-ubuntu-core.
The error happens because the binary you are trying to call from command line is only part of the current user's PATH variable, but not a part of root user's PATH.
You can verify this by locating the path of the binary you are trying to access. In my case I was trying to call "bettercap-ng". So I ran,
$ which bettercap-ng
output: /home/user/work/bin/bettercap
I checked whether this location is part of my root user's PATH.
$ sudo env | grep ^PATH
output: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
So sudo cannot find the binary that I am trying to call from commandline. Hence returns the error command not found.
You can direct sudo to use the current user's PATH when calling a binary like below.
$ sudo -E env "PATH=$PATH" [command] [arguments]
In fact, one can make an alias out of it:
$ alias mysudo='sudo -E env "PATH=$PATH"'
It's also possible to name the alias itself sudo, replacing the original sudo.
Please refer to this video for step by step solution
from docker-brew-ubuntu-core.
Put USER root
in the Dockerfile before the sudo apt-get xxx
, then you can switch back to a non-root user once all that is done.
from docker-brew-ubuntu-core.
Hi, not sure if this is the right place to post, I'm having the issue that sudo is missing and cannot be installed neither on a docker image using Ubuntu 16, the URI is broken:
Step 4/28 : RUN apt-get -y install sudo
---> Running in 05ff9cfdc6c1
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
sudo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 390 kB of archives.
After this operation, 1618 kB of additional disk space will be used.
Err:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 sudo amd64 1.8.16-0ubuntu1.3
404 Not Found [IP: 91.189.88.149 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/s/sudo/sudo_1.8.16-0ubuntu1.3_amd64.deb 404 Not Found [IP: 91.189.88.149 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get -y install sudo' returned a non-zero code: 100
from docker-brew-ubuntu-core.
from docker-brew-ubuntu-core.
Related Issues (20)
- Docker image 21.04 (rolling) - apt update error HOT 6
- less command missing Ubuntu 20.10 image HOT 1
- how to tell the version of python3 supported in the default repository without installing? HOT 2
- Repositories no longer have release files HOT 3
- changelogs of "native" packages are missing HOT 3
- Cannot create new threads in Ubuntu 21.10 HOT 2
- [Question] Why date is not updated when new version is created? HOT 2
- to use gpu but slow HOT 1
- Ubuntu:20.04 image usage guidelines HOT 1
- Update Ubuntu Focal 20.04 image to 20220105 HOT 9
- dpkg broken in Jammy image on singular-doc pkg extraction HOT 2
- Need help in increasing the windows/chrome resolution for Ubuntu image HOT 1
- Update Ubuntu Focal 20.04 image to 20220316 HOT 4
- apt update fails on ubuntu:jammy unless --security-opt seccomp=unconfined is specified HOT 16
- Rerun build job to update ubuntu image LTE 20.04 HOT 1
- `apt update` fails on macOS HOT 1
- how to build 16.04.4 docker image? HOT 1
- Q: Get SERIAL or GitHash from running image HOT 1
- ubuntu:latest throws an error "failed to solve with frontend dockerfile.v0" HOT 3
- Unable to build from ubuntu 21.04 since 23 july HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-brew-ubuntu-core.