- Docker
** Prepare docker
*** install docker package
*** start and enable service
sudo systemctl start docker.service
sudo systemctl enable docker.service
** add permission and groupsudo usermod -aG docker $USER
** reboot your computer ** check if docker worksdocker --version
sudo systemctl status docker.service
** get Ubuntu 16 base image- (
docker search ubuntu
to search image, goto https://hub.docker.com/ search the image and the right tag docker pull ubuntu:xenial
** create your Ubuntu container with share folderdocker run -it -v ~/Public/tig:/Public/tig --net host --name Ubuntu16.04LTS ubuntu:xenial /bin/bash
-it
-> interactive, not background-v
-> share folder--net host
-> using host network, proxy, don't forget to install proxychains4 and its cofig--name
-> new name/bin/bash
--> start command
- install the necessary packages ** add a non-root user following the link: https://www.cyberciti.biz/faq/create-a-user-account-on-ubuntu-linux/
useradd -s /bin/bash -d /home/new-user -m -G sudo new-user
passwd new-user
** commit the current container into a new imagedocker commit <container-ID> <new-image-name>
** start the container which starts with non-root user and workding dirdocker run -it -v ~/Public/tig:/Public/tig --net host --user <non-root-user-name> -w /home/new-user <new-image-name> /bin/bash
- NOTE: shared folder and net don't share between containers, you have to manually define them when creating new container based on a new image which is commited from a old container which contains the shared foler and net ** start the created container after exiting it
docker ps -a
to list all the containersdocker start -i $ID
to start the specific container(ID is indocker ps -a
) ** Misc docker commandsdocker container rm $ID
to remove the unneeded containerdocker image ls
-- check the size of the container
Last active
May 4, 2021 15:39
-
-
Save c02y/20038ef2f1f31198b733a5e16c8d8b12 to your computer and use it in GitHub Desktop.
Docker guide
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment