https://github.com/vin-dkr/docker
docker implementation
https://github.com/vin-dkr/docker
docker docker-compose docker-container docker-image
Last synced: about 2 months ago
JSON representation
docker implementation
- Host: GitHub
- URL: https://github.com/vin-dkr/docker
- Owner: vin-dKR
- Created: 2024-08-13T05:31:48.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-18T16:24:10.000Z (almost 2 years ago)
- Last Synced: 2024-11-10T15:12:25.401Z (over 1 year ago)
- Topics: docker, docker-compose, docker-container, docker-image
- Language: TypeScript
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Docker Basic Commands
#### 1. Docker Images
* `docker images`: Lists all the images available on the system.
* `docker pull `: Pulls an image from Docker Hub.
* `docker rmi `: Removes an image from the system.
#### 2. Docker Containers
* `docker ps`: Lists all running containers.
* `docker ps -a`: Lists all containers, including stopped ones.
* `docker run `: Runs a new container from an image.
* `docker run -p : `: Runs a new container with port mapping.
* `docker stop `: Stops a running container.
* `docker start `: Starts a stopped container.
* `docker rm `: Removes a container.
#### 3. Building Images
* `docker build -t .`: Builds an image from the current directory.
* `docker build -t -f Dockerfile .`: Builds an image from a specific Dockerfile.
#### 4. Running Images
* `docker run -d `: Runs a container in detached mode.
* `docker run -it `: Runs a container in interactive mode.
#### 5. Pushing to Docker Hub
* `docker login`: Logs in to Docker Hub.
* `docker tag /`: Tags an image for Docker Hub.
* `docker push /`: Pushes an image to Docker Hub.
#### 6. Optimizing Dockerfile with Layers
* `docker system prune -a`: Removes all unused images.
* `docker system prune -af`: Forces the removal of all unused images.
* `docker system prune -af && docker system prune -af`: Removes all unused images and then forces the removal again to ensure all layers are removed.
#### 7. Networks
* `docker network create `: Creates a new network.
* `docker network connect `: Connects a container to a network.
* `docker network disconnect `: Disconnects a container from a network.
#### 8. Volumes
* `docker volume create `: Creates a new volume.
* `docker volume prune -a`: Removes all unused volumes.
* `docker volume prune -af`: Forces the removal of all unused volumes.
#### 9. Docker Compose
* `docker-compose up`: Starts all services defined in docker-compose.yml.
* `docker-compose down`: Stops all services defined in docker-compose.yml.
* `docker-compose ps`: Lists all services defined in docker-compose.yml.