Comments (16)
adduser -D -u 1000 [username]
works like a charm! Thank you.
from docker-alpine.
I was able to do that using
FROM busybox
ARG PUID
ARG PGID
RUN addgroup -g ${PGID} abc && \
adduser -D -u ${PUID} -G abc abc
from docker-alpine.
@andyshinn I pulled most of the unrelated stuff out but here is an example that is failing for me with /bin/sh: useradd: not found
. I'm actually attempting to start Moxi with supervisor with the moxi user.
FROM gliderlabs/alpine:3.1
RUN apk --update add bash wget dpkg-dev
# Moxi - http://www.couchbase.com/downloads
RUN \
useradd moxi && \
cd /tmp && \
wget -q http://packages.couchbase.com/releases/2.5.0/moxi-server_2.5.0_x86_64.deb && \
dpkg -i moxi-server_2.5.0_x86_64.deb
# Start
CMD ["/opt/bin/moxi"]
from docker-alpine.
So, two things here:
- There is a
adduser
that is handled by BusyBox. You are probably looking foradduser -S moxi
. - You are trying to install a Debian package on Alpine. This won't work! You need either a musl compatible binary or a way to compile from source.
from docker-alpine.
@andyshinn okay thanks. Yeah I had a feeling this method wasn't going to work but I got stuck before I got to that point :)
It looks like adduser -S moxi
works though so that is good to know. I'll just mark as closed because I was mostly interested in knowing how to add a user with no password.
from docker-alpine.
The -D
option should do the trick, as the help says :
# adduser --help
BusyBox v1.27.2 (2017-12-12 10:41:50 GMT) multi-call binary.
Usage: adduser [OPTIONS] USER [GROUP]
Create new user, or add USER to GROUP
-h DIR Home directory
-g GECOS GECOS field
-s SHELL Login shell
-G GRP Group
-S Create a system user
-D Don't assign a password
-H Don't create home directory
-u UID User id
-k SKEL Skeleton directory (/etc/skel)
from docker-alpine.
Unfortunately doing so seems to disable the account (analogue of passwd -l
) instead of simply leaving the account passwordless (analogue of passwd -u
).
Which is troublesome when using the account for remote logins. For instance, the the use of a profile created utilising the -D
flag for script purposes would result the following error
User alpine not allowed because account is locked
Any workaround except calling passwd -u
after creation?
from docker-alpine.
Is there already a solution in 2019 for this?
from docker-alpine.
Can you supply an example Dockerfile
or steps that include using useradd
where it is not working as expected?
from docker-alpine.
How do you add a user that isn't locked? Apparently, I can use usermod -p '*' username
, but ideally I wouldn't have to install a package to get usermod
...
from docker-alpine.
I think the original question has been answered... -D creates it without a password... as for the second question by ashenm: can you not do something like:
adduser foo << PASSWORD
password
password # for confirmation
PASSWORD
or redirect from a file adduser foo < password.txt
or pipe it in echo "password\npassword" | adduser foo
?
or look at expect? I mean... really this is a sh question not an alpine-docker question... did you try googling it? because I just did, I've known about a couple of the hacks above, but didn't know about expect, and low and behold: https://stackoverflow.com/questions/14392525/passing-arguments-to-an-interactive-program-non-interactively
Either way, I'm not really sure that it's really a good ask... you really shouldn't be doing a remote ssh login on docker/kubernetes, it's a really insecure practice. kubectl exec -it
is better.
from docker-alpine.
Hey @AXington, as of my understanding there's a difference between a disabled account and a passwordless account (simply put an account with a blank password), and my question revolves around that very difference.
As outlined in my previous comment, the use of flag -D
while account creation seems to disable the created account instead of simply leaving the account passwordless which I find contrasting against the documentation;
-D Do not assign a password
While the above behaviour can be manipulated via numerous means to suit the desired outcome, the most straightforward being passwd -u
after creation, I find it contradictory against the aforesaid documentation and silly to chain multiple subroutines when the sequel can be embedded into adduser
itself.
Although the {docker,kubectl}\ exec
is the generally preferred mechanism for command execution, a Dockerized SSH service serving numerous purposes such as tunneling is a clear exception and therefore I believe my question still stands relevant.
from docker-alpine.
Either way, you're more likely to get a response from the developers if you ask the question in your own issue, rather than hijacking a 3 year old (now 4) closed issue where the OP's question was seemingly satisfied.
Also, you should be asking this of the right developers, not the people who put alpine on Docker. In this case, maybe busybox?
from docker-alpine.
It's already raised with BusyBox bearing reference 10981
from docker-alpine.
I assume then that you've also tried their mailing list? https://busybox.net/FAQ.html#bugs
from docker-alpine.
@AXington thanks for drawing my attentions to the mailing list! I have now lodged the proceeding deets.
from docker-alpine.
Related Issues (20)
- gliderlabs.com does not hav a valid DNS, so docker builds with thie base image fail HOT 2
- Require image for ARM64 architecture HOT 1
- Issue in minikube docker --> ERROR: http://nl.alpinelinux.org/alpine/v3.5/main: DNS lookup error HOT 1
- Time zone is really necessary?
- Issues with wget/apk in alpine:3.13.0 and up
- dl-cdn.alpinelinux.org was offline (12:18:56am Tuesday, 15 February 2022 gmt ~ 2:52:10am Tuesday, 15 February 2022) HOT 27
- Error 503 Backend is unhealthy HOT 12
- ERROR: unable to select packages: curl (no such package): required by: world[curl] Cleaning up file based variables HOT 1
- apk updates are failing 3.15,3.17 - ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.17/main: temporary error (try again later) HOT 1
- Package Manager Broken (apk update: temporary error) HOT 1
- Some guide for install docker alpine on android device HOT 1
- Issues accessing https://dl-cdn.alpinelinux.org HOT 3
- Build mono fail in docker alpine with Segmentation fault
- My
- Slow internet, bad signature errors
- ccccccjtgkneuknjkdtekjjnhnhhivnbehlhjcudfejr HOT 1
- Nslookup doesn't work in github actions HOT 2
- dcps
- alpine:latest can't use hostname to find a server.
- building docker compose in VM Ubuntu
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-alpine.