1 00:00:00,000 --> 00:00:04,400 [Intro Music] 2 00:00:04,470 --> 00:00:06,060 All right in the previous lecture I 3 00:00:06,060 --> 00:00:07,410 have explained you differences 4 00:00:07,410 --> 00:00:09,150 between management commands and 5 00:00:09,150 --> 00:00:11,280 commands; and you know that there 6 00:00:11,280 --> 00:00:12,780 are pairs of commands that are 7 00:00:12,780 --> 00:00:14,670 called alternative commands; and you 8 00:00:14,670 --> 00:00:16,649 are able to use either alternative 9 00:00:16,680 --> 00:00:18,510 short command or long command with 10 00:00:18,510 --> 00:00:19,950 management command. For example, 11 00:00:19,980 --> 00:00:22,620 'docker ps' and 'docker container ls' 12 00:00:22,740 --> 00:00:24,660 is pair of alternative commands. 13 00:00:25,140 --> 00:00:27,270 Alright, let's now proceed and I'll 14 00:00:27,270 --> 00:00:29,040 tell you now about most popular 15 00:00:29,040 --> 00:00:30,900 commands that are used for 16 00:00:30,930 --> 00:00:32,700 containers management in Docker. 17 00:00:33,060 --> 00:00:34,950 First command, 'docker run' is 18 00:00:34,980 --> 00:00:36,840 short version of command 'docker 19 00:00:36,840 --> 00:00:39,450 container run'. This command starts a 20 00:00:39,510 --> 00:00:42,120 new container, and you are able to 21 00:00:42,120 --> 00:00:43,650 create multiple containers 22 00:00:43,680 --> 00:00:45,690 simultaneously on the same Docker 23 00:00:45,690 --> 00:00:48,600 computer. Next command 'docker stop', 24 00:00:48,750 --> 00:00:50,550 this command stops running 25 00:00:50,550 --> 00:00:53,760 container. And when this command is 26 00:00:53,760 --> 00:00:55,770 executed, Docker basically sends 27 00:00:55,800 --> 00:00:58,590 under the hood SIGTERM signal 28 00:00:58,620 --> 00:01:00,210 to specific process inside of the 29 00:01:00,210 --> 00:01:02,160 container; and if that process 30 00:01:02,190 --> 00:01:04,410 reacts to SIGTERM command, then 31 00:01:04,410 --> 00:01:06,000 container will be stopped pretty 32 00:01:06,000 --> 00:01:08,820 fast. But sometimes processes don't 33 00:01:08,820 --> 00:01:10,830 react to SIGTERM signal; and in 34 00:01:10,830 --> 00:01:12,690 such case, after entering the 35 00:01:12,690 --> 00:01:14,250 'docker stop' command, you'll need 36 00:01:14,250 --> 00:01:16,650 to wait 10 seconds, and afterwards 37 00:01:16,680 --> 00:01:18,720 Docker will fall back to 'docker 38 00:01:18,720 --> 00:01:20,940 kill' command; and this command 39 00:01:20,970 --> 00:01:24,000 actually sends a SIGKILL signal to 40 00:01:24,000 --> 00:01:25,650 specific process; and 41 00:01:25,680 --> 00:01:27,480 corresponding container terminates 42 00:01:27,540 --> 00:01:30,480 very fast. All right next command 43 00:01:30,510 --> 00:01:32,760 is 'docker rm'. With this command you 44 00:01:32,760 --> 00:01:34,590 are able to remove a specific 45 00:01:34,590 --> 00:01:36,870 container that was already stopped. 46 00:01:37,140 --> 00:01:39,420 You're not able to remove a running 47 00:01:39,420 --> 00:01:41,610 container, you need to stop it first, 48 00:01:41,610 --> 00:01:43,710 and only afterwards remove with 49 00:01:43,710 --> 00:01:46,290 'docker rm' command. Next command, 50 00:01:46,320 --> 00:01:49,050 'docker ps', lists running containers, 51 00:01:49,140 --> 00:01:50,340 and this command is already 52 00:01:50,340 --> 00:01:52,470 familiar to you, and I have used it 53 00:01:52,470 --> 00:01:54,510 in a previous lecture. Alternative 54 00:01:54,510 --> 00:01:56,310 long version is 'docker container 55 00:01:56,310 --> 00:01:59,280 ls'. And last command is 'docker ps 56 00:01:59,310 --> 00:02:02,040 -a'. With '-a' option 57 00:02:02,070 --> 00:02:05,190 supplied to 'ps' command you're able 58 00:02:05,190 --> 00:02:07,200 to list all containers including 59 00:02:07,230 --> 00:02:09,960 stopped containers. Please notice 60 00:02:09,960 --> 00:02:11,610 that instead of '-a' option, you're 61 00:02:11,610 --> 00:02:14,100 able to use also long version of 62 00:02:14,100 --> 00:02:17,220 this option, '--all'. That's all 63 00:02:17,220 --> 00:02:18,960 for most popular container 64 00:02:18,960 --> 00:02:21,030 management commands. And next let 65 00:02:21,030 --> 00:02:22,770 me briefly overview most popular 66 00:02:22,800 --> 00:02:24,720 images commands. 'docker pull' 67 00:02:24,720 --> 00:02:27,150 command is used for pulling image 68 00:02:27,180 --> 00:02:29,610 from Docker Hub. And if 69 00:02:29,640 --> 00:02:31,650 corresponding image already exists 70 00:02:31,680 --> 00:02:33,840 in your local cache, then no pull 71 00:02:33,870 --> 00:02:35,370 will be performed, and you will be 72 00:02:35,370 --> 00:02:37,020 able to simply reuse currently 73 00:02:37,080 --> 00:02:38,970 located in your local cache image. 74 00:02:39,720 --> 00:02:42,000 Next command 'docker images' lists 75 00:02:42,030 --> 00:02:44,640 downloaded images that were already 76 00:02:44,670 --> 00:02:46,470 downloaded, pulled from Docker hub 77 00:02:46,500 --> 00:02:49,950 to your local cache. 'docker rmi', 78 00:02:50,010 --> 00:02:52,560 removes image or images from your 79 00:02:52,590 --> 00:02:54,810 local cache. If you don't need some 80 00:02:54,840 --> 00:02:56,610 images, you could simply use this 81 00:02:56,610 --> 00:02:58,320 command in order to free up some 82 00:02:58,320 --> 00:03:00,900 space on your local setup. And 83 00:03:00,900 --> 00:03:02,610 finally, example of additional 84 00:03:02,610 --> 00:03:04,170 commands that you could use along 85 00:03:04,200 --> 00:03:06,360 with images is 'docker build.'. 86 00:03:06,570 --> 00:03:08,580 With this command you're able to 87 00:03:08,580 --> 00:03:11,190 create new custom image based on 88 00:03:11,190 --> 00:03:13,620 created Dockerfile. And we will 89 00:03:13,620 --> 00:03:14,940 talk about that in one of the next 90 00:03:14,940 --> 00:03:16,950 sections when I'll explain you how 91 00:03:16,950 --> 00:03:19,230 to create custom images, and how to 92 00:03:19,230 --> 00:03:22,050 push them to your account at Docker 93 00:03:22,050 --> 00:03:24,930 Hub. Great, that's all for most 94 00:03:24,930 --> 00:03:27,360 popular commands that are used for 95 00:03:27,360 --> 00:03:29,100 management of images, for pulling 96 00:03:29,100 --> 00:03:30,990 images, listing images, and removing 97 00:03:31,020 --> 00:03:33,480 images. And next let's start some 98 00:03:33,480 --> 00:03:35,760 practice activities, and let's pull 99 00:03:35,790 --> 00:03:37,590 first image from Docker Hub, and 100 00:03:37,590 --> 00:03:39,120 create container based on that 101 00:03:39,150 --> 00:03:40,620 image. I'll see you in the next 102 00:03:40,620 --> 00:03:41,600 lecture. Bye-Bye. 103 00:03:41,600 --> 00:03:44,042 [no audio]