- Create a Dockerfile
FROM nginx:alpine-slim
COPY ./public /usr/share/nginx/html
- Build the image
docker build -t toodev/my-web:latest .
- Run the image
docker run -d -p 80:80 toodev/my-web:latest --name my-web
- Open your browser and go to http://localhost
- Login to Docker Hub
docker login
- Tag the image
docker tag toodev/my-web:latest toodev/my-web:latest
- Push the image
docker push toodev/my-web:latest
- Pull the image
docker pull toodev/my-web:latest
- Run the image
docker run --name my-web -d -p 80:80 toodev/my-web:latest
- Open your browser and go to http://localhost or http://localhost:80
- Stop the container
docker stop my-web
- Remove the container
docker rm my-web
- Remove the image
docker rmi toodev/my-web:latest
- Stop all containers
docker stop $(docker ps -a -q)
- Remove all containers
docker rm $(docker ps -a -q)
- Remove all volumes
docker volume rm $(docker volume ls -q)
- Remove all networks
docker network rm $(docker network ls -q)
- Remove all images
docker rmi $(docker images -q)
- Remove all cache
docker system prune -a