Docker Commands
- March 11th, 2022
- Write comment
Run vs exec:
docker exec is used to run commands in an already running container. docker run is used to create a new container that can be committed to create an updated container.
Here is how execute commands inside a docker container as root:
$ docker exec -u 0 -it runningcontainer bash
The same concept works for docker run too:
Here is how execute commands inside a docker container as root:
$ docker run -u 0 -it dockerimage bash
This will clean up the /var/lib area:
docker system prune -a