mirror of
https://github.com/sharevb/it-tools.git
synced 2026-12-04 18:35:09 +03:00
1 parent
58e2fb39b7
commit
3b21a6b60e
1 file changed
+15
-15
@@ -19,13 +19,13 @@ Docker images are a lightweight, standalone, executable package of software that
|
|||||||
Build an Image from a Dockerfile
|
Build an Image from a Dockerfile
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker build -t <image_name> .
|
docker build -t <image_name> .
|
||||||
```
|
```
|
||||||
|
|
||||||
Build an Image from a Dockerfile without the cache
|
Build an Image from a Dockerfile without the cache
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker build -t <image\_name> . -no-cache
|
docker build -t <image\_name> . -no-cache
|
||||||
```
|
```
|
||||||
|
|
||||||
List local images
|
List local images
|
||||||
@@ -37,7 +37,7 @@ docker images
|
|||||||
Delete an Image
|
Delete an Image
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker rmi <image\_name>
|
docker rmi <image\_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove all unused images
|
Remove all unused images
|
||||||
@@ -53,25 +53,25 @@ Docker Hub is a service provided by Docker for finding and sharing container ima
|
|||||||
Login into Docker
|
Login into Docker
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker login -u <username>
|
docker login -u <username>
|
||||||
```
|
```
|
||||||
|
|
||||||
Publish an image to Docker Hub
|
Publish an image to Docker Hub
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker push <username>/<image\_name>
|
docker push <username>/<image\_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
Search Hub for an image
|
Search Hub for an image
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker search <image\_name>
|
docker search <image\_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
Pull an image from a Docker Hub
|
Pull an image from a Docker Hub
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker pull <image\_name>
|
docker pull <image\_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the docker daemon
|
Start the docker daemon
|
||||||
@@ -99,49 +99,49 @@ A container is a runtime instance of a docker image. A container will always run
|
|||||||
Create and run a container from an image, with a custom name:
|
Create and run a container from an image, with a custom name:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --name <container\_name> <image\_name>
|
docker run --name <container\_name> <image\_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
Run a container with and publish a container's port(s) to the host.
|
Run a container with and publish a container's port(s) to the host.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -p <host\_port>:<container\_port> <image\_name>
|
docker run -p <host\_port>:<container\_port> <image\_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
Run a container in the background
|
Run a container in the background
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -d <image\_name>
|
docker run -d <image\_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
Start or stop an existing container:
|
Start or stop an existing container:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker start|stop <container\_name> (or <container-id>)
|
docker start|stop <container\_name> (or <container-id>)
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove a stopped container:
|
Remove a stopped container:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker rm <container\_name>
|
docker rm <container\_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
Open a shell inside a running container:
|
Open a shell inside a running container:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker exec -it <container\_name> sh
|
docker exec -it <container\_name> sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Fetch and follow the logs of a container:
|
Fetch and follow the logs of a container:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker logs -f <container\_name>
|
docker logs -f <container\_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
To inspect a running container:
|
To inspect a running container:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker inspect <container\_name> (or <container\_id>)
|
docker inspect <container\_name> (or <container\_id>)
|
||||||
```
|
```
|
||||||
|
|
||||||
To list currently running containers:
|
To list currently running containers:
|
||||||
|
|||||||
Reference in new issue
Block a user