Docker Tips - stereoboy/Study GitHub Wiki
- DB Docker
- Docker Compose References
docker inspect <container_name> -f "{{json .NetworkSettings.Networks }}"
sudo apt-get install debconf-doc
man 7 debconf
- https://stackoverflow.com/questions/49049949/how-to-accept-license-agreement-during-docker-build
- https://askubuntu.com/questions/972516/debian-frontend-environment-variable
- https://stackoverflow.com/questions/22466255/is-it-possible-to-answer-dialog-questions-when-installing-under-docker/35976127#35976127
- How to use dialog frontend such as
whiptail
ordialog
to display question - How to use DEBIAN_FRONTEND in
Dockerfile
- Hidden Option
DEBIAN_FRONTEND=teletype
- Official
debconf
git repository
- Official
# to set automatic answer for interactive install
RUN echo "yes" | DEBIAN_FRONTEND="teletype" apt-get install -y /<debian_package>.deb
- https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes
- Remove all docker images
docker system prune -a
docker system prune -f
docker system prune
docker image prune -f
docker exec -it <container> bash
- get
<user_name>
,<uid>
fromid -u
,<gid>
fromid -g
in HOST - access as root:
docker exec -it <container> /bin/bash
apt-get install sudo
groupadd -g <gid> <user_name> // create group
useradd -m -r -u <uid> -g <user_name> <user_name> // create user, -m for creating home directory /home/<user_name>
passwd <user_name>
usermod -aG sudo,adm <user_name> // set user into groups
User is not in the sudoers file. This incident will be reported On using the sudo command if we see the error User is not in the sudoers file. This incident will be reported This means that the user as whom we have logged in and are trying to run the command "sudo" does not have the permission to do so. Only the users listed in /etc/sudoers have the permission to use the command "sudo". To give the sudo permission to a user we need to add the user to the file /etc/sudoers file. Open the file /etc/sudoers as root.
sudo vi /etc/sudoers
- Add the line
username ALL = (ALL) ALL
- access as user_name:
docker exec -it --user $(id -u):$(id -g) <container_name> /bin/bash
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run -it \
--volume=$XSOCK:$XSOCK:rw \
--volume=$XAUTH:$XAUTH:rw \
--env="XAUTHORITY=${XAUTH}" \
--env="DISPLAY"=${DISPLAY} \
nvidia/cudagl:10.1-devel-ubuntu18.04 \
/bin/bash
- References
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run --gpus=all -it \
--volume=$XSOCK:$XSOCK:rw \
--volume=$XAUTH:$XAUTH:rw \
--env="XAUTHORITY=${XAUTH}" \
--env="DISPLAY=${DISPLAY}" \
--env="NVIDIA_DRIVER_CAPABILITIES=all" \
nvidia/cudagl:10.1-devel-ubuntu18.04 \
/bin/bash