This is the default Docker setup for the whole company. Regardless of what operating system you are using, with this Docker file we have a consistent plane field to work from.
Follow this instructions to install Docker for your operating system.
docker build --no-cache --build-arg "user=$USER" -t 0x4447:latest .
Run the following command in Windows PowerShell:
docker build --no-cache --build-arg "user=$env:USERNAME" -t 0x4447:latest .
- Note:
$env:USERNAME
is a powershell specific variable.
How to run the container.
Running the image in interactive mode.
docker run -it -h docker 0x4447:latest
Running the image in interactive mode + mounting your active working directory.
docker run -it -h docker --mount src="$(pwd)",target="/home/$USER/workdir/",type=bind 0x4447:latest
Running image in interactive mode + mounting a fixed directory.
docker run -it -h docker --mount src=/path/to/folder,target="/home/$USER/workdir/",type=bind 0x4447:latest
Running the image in interactive mode + RDP listening on port 15050/tcp (remote desktop available on rdp://localhost:15050/)
docker run -p 15050:3389 -it -h docker 0x4447:latest
- Note: RDP access details will be available in
~/.rdp_credentials
file in form<username>:<password>
Run the following command in Windows PowerShell:
docker run -it -h docker --mount src="$((Get-Location).Path -replace "\\", '/')",target="/home/$env:USERNAME/workdir/",type=bind 0x4447:latest
- Note:
$((Get-Location).Path -replace "\\", '/')
is a powershell specific command string. - Note:
$env:USERNAME
is a powershell specific variable.
This can be done by setting the $TZ
Environment variable:
docker run -it -e TZ=Europe/Amsterdam 0x4447:latest
By adding the above command to your shell you'll be able to just type vm_docker
to get in to your container and work, without having to remember the long command.
*nix
Add the following to your .bash_profile
or .bashrc
in your $HOME
directory.
vm_docker(){
docker run -it -h docker --mount src=/Users/"$USER"/Documents/GitHub,target="/home/$USER/workdir/",type=bind 0x4447:latest
}
Add the following to your .zshrc
in your $HOME
directory:
vm_docker_x() {
docker run -p 15050:3389 -it -h docker --mount src=/Users/davidgatti/Documents/GitHub,target="/home/$USER/workdir/",type=bind 0x4447:latest
}
vm_docker() {
docker run -it -h docker --mount src=/Users/davidgatti/Documents/GitHub,target="/home/$USER/workdir/",type=bind 0x4447:latest
}
Add the following to your PowerShell $PROFILE
:
function vm_docker {
docker run -it -h docker --mount src="$((Get-Location).Path -replace "\\", '/')",target="/home/$env:USERNAME/workdir/",type=bind 0x4447:latest
}
Note: function function_name {}
is a powershell specific command string.
Note: $((Get-Location).Path -replace "\\", '/')
is a powershell specific command string.
Note: $env:USERNAME
is a powershell specific variable.
You can remove exited docker containers with the following command
docker rm $(docker ps -aq --filter status=exited)
docker image prune -f
You can remove all the images with the following command
docker rmi $(docker images -q)