Some Docker memos
List images
docker images
Start a container and a terminal
docker run -ti --rm microsoft/aspnetcore
–rm is used to have docker remove the container when it is stopped.
Start a container and map a folder
docker run -ti --rm -v '/my/rooted/host/folder':'/MyRootedContainerFolder' microsoft/aspnetcore
Start a container, open a network hole, map a folder and start a process (a web server in this case)
docker run -p80:80 -ti --rm -v '/MyRootedFolder/WebApplication1/bin/Debug/netcoreapp1.1/publish':'/Web' microsoft/aspnetcore /bin/bash -c 'cd /Web; dotnet WebApplication1.dll'
Connect to a running container
See more att https://stackoverflow.com/a/30173220/521554
To list the active processes:
docker ps
Then attach through:
docker exec -it <mycontainer> bash
List also not running containers
docker ps -a
Remove old containers
Find the old containers
docker ps -a
Remove chosen
docker rm <container id>
There is no risk in removing running containers with above command.
See the IP addresses used by the containers
docker network inspect bridge
Tags: docker