Basic Administration Commands –
docker ps
docker images
docker ps -a
docker logs nginx02
if you see error like this while creating a new container
docker: Error response from daemon: Conflict. The container name "/nginx01" is already in use by container "eb89065e7e8f529a648893hfgte6rbf6je83d69ed8627e5948816ef3ca22bd9fe5". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
Then you need to either remove the existing one or create a new container with a separate name
docker stop ad0c99f050e3
docker rm c7906c2cfc75
docker run - this is used to start the container in run time mode
docker start - this is used to start container as a background process
Some BAsic commands
docker container ls
docker images purge
docker images -a | grep "pattern" | awk '{print $3}' | xargs docker rmi
docker images -a | grep "9" | awk '{print $3}' | xargs docker rmi
docker image ls
docker images purge
docker rmi $(docker images -a -q)
docker image ls
docker container stop 7a6708c94b14
docker system prune
docker image ls
docker system prune --volumes
docker container rm node
docker container rm d8c33ae35f44
docker container ls -a --filter status=exited --filter status=created
docker container prune
docker image ls
Container Location
/var/lib/docker/containers
to run a command inside the container –
docker exec -it containerid redis-cli
get into the docker container shell
docker exec -it containerid sh/code>
creating our own docker images –
Dockerfile —> Docker Client —> Docker Server —> Usable Image
Creating a docker file –
baseimage —- run some commands —— command ot rin the container at the startup