docker pull <<Image Name>> e.g docker pull sonarqube
docker run -d --name sonarqube -p 9000:9000 sonarqube:latest (-d In background, --name associate name for the container)
docker run --name sonarqube -p 9000:9000 sonarqube:latest
docker run --rm --name sonarqube -p 9000:9000 -e SONARQUBE_ADMIN_PASSWORD="Welcome1" techforum/sonarqube-with-custom-plugins-aem:latest(--rm remove existing container,-e SONARQUBE_ADMIN_PASSWORD="Welcome1" environment variable)
docker run --rm --name sonarqube -p 9000:9000 -v /mnt/c/Albin/blogData/docker-container-files/data:/opt/sonarqube/data -v /mnt/c/Albin/blogData/docker-container-files/logs:/opt/sonarqube/logs -e SONARQUBE_ADMIN_PASSWORD="Welcome1" techforum/sonarqube-with-custom-plugins-aem:latest (-v volume mapping, map docker volume to host folder)
docker push techforum/sonarqube-with-custom-plugins-aem:latest
List out the active containers
docker ps -a
docker ps -a -f name=sonarqube(container with specific name)
docker container restart sonarqube
docker container stop sonarqube
docker container restart sonarqube
docker container start sonarqube
docker logs sonarqube
Run multi container application (execute the docker compose comands from the folder where docker-compose.yml file is stored)
docker-compose up
docker-compose up -d (-d run the containers in background)
docker-compose stop
docker-compose start
View Docker Composer Logs
docker-compose logs -f (-f displays the current logs)
docker volume ls
docker volume rm -f <Volume Name>
docker inspect <Volume Name>
docker inspect --format="{{.Mounts}}" <Container Name>
docker inspect <Volume Name> | grep Mountpoint | awk '{ print $2 }'
Execute Commands inside running container
docker exec -it <Container Id> /bin/bash (execute the the commands in the bash shell)