Portainer the Window to Docker

I started using docker about 2 days ago and just as I know myself I already put it in production without knowing too much about it. Of course I had a bad experience, especially when after using a wordpress docker and doing development on the site, I did run:

docker-compose down

and then I did run:

 docker-compose up

Then I logged into my docker and I saw ….. ALL MY CHANGES GONE!

Clearly I do not have a good understanding of docker and docker-compose, so I decided to install an interface to help me understand the concept. I chose Portainer.

Here are some usefull commands:

docker run  -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer //create portainer without naming it
docker run --name portainer -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer  //create portainer naming it 
docker ps //To show only running containers
docker ps -a //To show all containers
docker ps -l //To show the latest created container
docker ps -n=-1  //To show n last created containers
docker ps -s  //To display total file sizes 

To reset the environment:

docker ps -aq ;docker stop $(docker ps -aq) ;docker rm $(docker ps -aq) ;docker rmi $(docker images -q) ;docker network rm $(docker network ls)

Leave a Reply

Your email address will not be published. Required fields are marked *