Answer the question
In order to leave comments, you need to log in
How to write text to a file?
I'm trying to create my own image based on the ubuntu:latest image, in which the /helloworld file will exist with the name of the current system user. Here is the Dockerfile:
FROM ubuntu
COPY helloworld /helloworld
RUN echo $USER > /helloworld
docker run -t -i docktor888/hw /bin/bash
ls && cat /helloworld
touch /helloworld
Answer the question
In order to leave comments, you need to log in
Most likely, the $USER variable is simply not defined at the build stage.
Even worse, you can redefine the user when starting the container from the image, and such a docker image will become meaningless:
docker run -u <айди пользователя> <имя образа> whoami
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question