Running a Docker Container from an Image
docker run -d -P --rm --env MYSQL_ROOT_PASSWORD=my-secret-pw mysql
-d
will create a container with the process detached from terminal
-P
will publish all the exposed container ports to random ports on the Docker host
-env
is how you pass environment variables to the container
--rm
will remove the container image on exit
docker ps // Default only shows running containers
docker ps -a // All running and exited containers
Stops a running Container
docker stop <containerName>
Update Conatiner Resource Limit
docker container update
Access the container that is running
docker exec -it <conatainer_name> bash
Shows image currently in local repository
docker images
Removes an Image from Local Registry
docker rmi <image>
Pulls an Image from Registry
docker pull <image>
Create Image from Dockerfile
docker build -t <tagName>
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
Pushing to Docker Registry
docker push learn/httpd_image