- Change directory into any desired mount point and run the container:
cd $DATA_DIR
NOTE:
$DATA_DIRis any directory you want to mount from your host machine in order to make it accessible within the container.
-
Change directory into any desired mount point (see
$DATA_DIRabove) and run the container:docker run --mount type=bind,source=$(pwd),target=/root -w /root -td --hostname alpine1 --name alpine1 alpine -
Exec into the container using
ashorsh:docker exec -it alpine1 sh
-
Change directory into any desired mount point (see
$DATA_DIRabove) and run the container:docker run --mount type=bind,source=$(pwd),target=/root -w /root -td --hostname arch1 --name arch1 archlinux -
Exec into the container using
bash:docker exec -it arch1 bash
-
Change directory into any desired mount point (see
$DATA_DIRabove) and run the container:docker run --mount type=bind,source=$(pwd),target=/root -w /root -td --hostname oralinux1 --name oralinux1 oraclelinux -
Exec into the container using
bash:docker exec -it oralinux1 bash
-
Change directory into any desired mount point (see $DATA_DIR above) and run the container:
docker run --mount type=bind,source=$(pwd),target=/root -w /root -td --hostname ubuntu --name ubuntu1 ubuntu:20.04 -
Exec into the container using
bash:docker exec -it ubuntu1 bash
-
Change directory into any desired mount point (see
$DATA_DIRabove) and run the container:docker run --mount type=bind,source=$(pwd),target=/root -w /root -td --hostname opensuse --name opensuse1 opensuse/tumbleweed -
Exec into the container using
bash:docker exec -it opensuse1 bash
-
Change directory into any desired mount point (see
$DATA_DIRabove) and run the container:docker run --mount type=bind,source=$(pwd),target=/root -w /root -td --hostname centos --name centos1 centos:latest -
Exec into the container using
bash:docker exec -it centos1 bash
-
Change directory into any desired mount point (see
$DATA_DIRabove) and run the container:docker run --privileged -e DOCKER_TLS_CERTDIR=/certs --mount type=bind,source=$(pwd),target=/root -w /root --name dind -td docker:dind -
Exec into the container using
ashorsh:docker exec -it dind sh