You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2463,6 +2463,7 @@ List
2463
2463
2464
2464
<details>
2465
2465
<summary>What is Docker? What are you using it for?</summary><br><b>
2466
+
Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
2466
2467
</b></details>
2467
2468
2468
2469
<details>
@@ -2504,10 +2505,12 @@ Docker daemon redirects output from container to Docker CLI which redirects it t
2504
2505
2505
2506
<details>
2506
2507
<summary>How do you run a container?</summary><br><b>
2508
+
docker run
2507
2509
</b></details>
2508
2510
2509
2511
<details>
2510
2512
<summary>What `docker commit` does?. When will you use it?</summary><br><b>
2513
+
Create a new image from a container’s changes
2511
2514
</b></details>
2512
2515
2513
2516
<details>
@@ -2531,20 +2534,30 @@ Docker daemon redirects output from container to Docker CLI which redirects it t
2531
2534
2532
2535
<details>
2533
2536
<summary>How do you remove old, non running, containers?</summary><br><b>
2537
+
1. To remove one or more Docker images use the docker container rm command followed by the ID of the containers you want to remove.
2538
+
2. The docker system prune command will remove all stopped containers, all dangling images, and all unused networks
2539
+
3. docker rm $(docker ps -a -q) - This command will delete all stopped containers. The command docker ps -a -q will return all existing container IDs and pass them to the rm command which will delete them. Any running containers will not be deleted.
2534
2540
</b></details>
2535
2541
2536
2542
##### Dockerfile
2537
2543
2538
2544
<details>
2539
2545
<summary>What is Dockerfile</summary><br><b>
2546
+
Docker can build images automatically by reading the instructions from a Dockerfile. A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.
2540
2547
</b></details>
2541
2548
2542
2549
<details>
2543
2550
<summary>What is the difference between ADD and COPY in Dockerfile?</summary><br><b>
2551
+
COPY takes in a src and destination. It only lets you copy in a local file or directory from your host (the machine building the Docker image) into the Docker image itself.
2552
+
ADD lets you do that too, but it also supports 2 other sources. First, you can use a URL instead of a local file / directory. Secondly, you can extract a tar file from the source directly into the destination.
2553
+
Although ADD and COPY are functionally similar, generally speaking, COPY is preferred. That’s because it’s more transparent than ADD. COPY only supports the basic copying of local files into the container, while ADD has some features (like local-only tar extraction and remote URL support) that are not immediately obvious.
2544
2554
</b></details>
2545
2555
2546
2556
<details>
2547
2557
<summary>What is the difference between CMD and RUN in Dockerfile?</summary><br><b>
2558
+
RUN lets you execute commands inside of your Docker image. These commands get executed once at build time and get written into your Docker image as a new layer.
2559
+
CMD is the command the container executes by default when you launch the built image. A Dockerfile can only have one CMD.
2560
+
You could say that CMD is a Docker run-time operation, meaning it’s not something that gets executed at build time. It happens when you run an image. A running image is called a container.
0 commit comments