Basic commands for Docker
I will write some useful commands to work with Docker. If I use them often, I will remember them, otherwise I will remember them quickly if I read this post.
Show the list of the docker images:
docker images
Show the list of the containers:
docker ps
Execute the docker container:
docker exec -it c486e0dcca17
if you add 'sh', you will go to docker container file system
docker exec -it c486e0dcca17 sh
After that you go inside the container. If you enter 'ls', you can see the list of directories inside
Build docker from text files
You can download a docker file from github, so at first you have to build it:
with SSH:
docker build - < Dockerfile
with Powershell on Windows, you can run:
Get-Content Dockerfile | docker build -
Remove docker container:
docker rm feb5d9fea6a5
Remove docker image:
docker rmi feb5d9fea6a5
To stop docker container:
docker stop feb5d9fea6a5
If you got 'permission denied' on stop, try this command:
sudo aa-remove-unknown