Last active
September 23, 2024 12:09
-
-
Save mitchwongho/11266726 to your computer and use it in GitHub Desktop.
Docker 'run' command to start an interactive BaSH session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming an Ubuntu Docker image | |
$ docker run -it <image> /bin/bash |
Thanks for that tip
…On Sun, Feb 7, 2021, 13:36 RafaelWO ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
For me none of the above commands worked. I ran docker inspect <image>
and got
...
"Cmd": [
"src/service.py"
],
"Entrypoint": [
"python"
],
...
I figured out that docker run -it --entrypoint "" <image> sh works in
this case.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/11266726#gistcomment-3623078>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGYIZPPY2GG27HLHUJOMH3S5Z3LXANCNFSM4NMUTH5A>
.
I have this in my Dockerfile to run java 16 (watch out for the modified java.security part)
FROM adoptopenjdk/openjdk16:jre-16.0.1_9-ubi-minimal
ARG RUN_JAVA_VERSION=1.3.8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
RUN microdnf install curl ca-certificates \
&& microdnf update \
&& microdnf clean all \
&& mkdir /deployments \
&& chown 1001 /deployments \
&& chmod "g+rwX" /deployments \
&& chown 1001:root /deployments \
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
&& chown 1001 /deployments/run-java.sh \
&& chmod 540 /deployments/run-java.sh \
&& echo "securerandom.source=file:/dev/urandom" >> /opt/java/openjdk/conf/security/java.security
sudo docker run -it --entrypoint /bin/bash node:latest #Thanks to @jghaines
...........9e0d1dcbc703 node:latest "/bin/bash" 12 minutes ago Up 12 minutes trusting_yonath #Thanks to Solomon Hykes
sudo docker trusting_yonath bash -c "echo 'Hello World, again!' >> file.txt" #Thanks to Stackoverflow
...........bin boot dev etc file.txt home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var #Thanks to Stallman&Torvalds
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For me none of the above commands worked. I ran
docker inspect <image>
and gotI figured out that
docker run -it --entrypoint "" <image> sh
works in this case.