The RUN instruction will execute a command of your choosing while building the image. The command will be run exactly as if you had typed it in a shell on the guest OS. You can use these commands to permanently update the contents of the image. RUN is useful for installing dependencies or running a script in the container at build time.
The run instruction will execute the command of your choosing while 0:00 building the image. 0:04 The command will be run exactly as if you had typed in a shell on the guest OS. 0:05 You can use these commands to permanently update the contents of the image. 0:10 Run is useful for installing dependencies or 0:15 running a script in the container at build time. 0:17 This pair of commands here both run the ubuntu apps get package manager. 0:20 The first updates the list of available packages and 0:24 the second uses that updated list to install python3. 0:28 The form of one instruction shown here is called the shell form which will execute 0:31 the given command using a shell like bash. 0:35 You should use this form if there are environment variables or 0:39 file name wild cards whose values you want substituted into the command. 0:42 The second form of RUN is called the exec form. 0:47 Let me convert this first instruction to exec form. 0:50 We use JSON array syntax with square brackets. 0:53 We'll surround each element with quotation marks and 0:59 we'll separate the elements with commas. 1:01 The first element should be the executable you want to run, 1:04 in this case that's apt-get. 1:07 All subsequent elements are arguments to that executable. 1:10 The exec form just passes your parameters directly to the given executable 1:14 without invoking a shell or doing any substitution. 1:19 You should use the exec form if you want to be very precise about the arguments you 1:22 pass to the executable. 1:26 So to finish converting this one, we'll use update as our second argument and 1:28 -y as our third. 1:33 And this run instruction in exec form is identical in meaning to this run 1:37 instruction in shell form. 1:41
You need to sign up for Treehouse in order to download course files.Sign up