
Join the Conversation!
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
"Please login to view comments"
Subscribing gives you access to the comments so you can share your ideas, ask questions, and connect with others.
By logging in, you'll unlock full access to this and other free tutorials on JSM Pro.
Why? Logging in lets us personalize your learning experience, track your progress, and keep you in the loop with new workshops, coding tips, and platform updates.
You'll also be the first to know about upcoming launches, events, and exclusive discounts.
No spam—just helpful content to level up your skills.
If that sounds fair, go ahead and log in to continue →
Enter your name and email to get instant access
##Looks like we found a thief monkey By the way, I liked the trick how you reached till here. You have a good sense of humor. You will improve a lot if you join our course with this passion.
var
(function-scoped, outdated)let
(block-scoped, modern and recommended)const
(block-scoped, cannot be reassigned)_
, or $
let let = 5;
is invalid)myVar
and myvar
are different)string
, number
, boolean
, null
, undefined
, bigint
, symbol
Objects
, Arrays
, Functions
Subscribing gives you access to a brief, insightful summary of each lecture to stay on track.
00:00:00 We can start from a super simple Docker app that says hello world.
00:00:06 Let's create a new folder called hello-docker.
00:00:11 Within it, we can create a simple hello.js file, and we can type something like console.log hello-docker.
00:00:23 Then comes the interesting part.
00:00:26 Next, we'll create a Docker file.
00:00:29 Yep, it's just Docker file like this.
00:00:32 No dots, no extensions.
00:00:35 VS Code might prompt you to install a Docker extension, and if it does, just go ahead and install it.
00:00:41 Now let's figure out what goes into the Docker file.
00:00:45 Do you remember the special Docker syntax we talked about earlier?
00:00:48 Well, let's put it to use.
00:00:51 First, we have to select the base image to run the app.
00:00:54 We want to run a JavaScript file so we can use the node runtime from the Docker Hub.
00:00:59 We'll use this one with an Alpine version.
00:01:03 It's a lightweight version of Linux.
00:01:05 So we can type something like from node 20-alpine.
00:01:13 Next, we want to set the working directory to forward slash app.
00:01:17 This is the directory where commands will be run.
00:01:20 And then forward slash app is a standard convention.
00:01:23 So we can type workdir and then type forward slash app.
00:01:29 Next, we can write copy dot dot like this.
00:01:33 This will copy everything from our current directory to the Docker image.
00:01:38 The first dot is the current directory on our machine.
00:01:42 And the second dot is the path to the current directory within the container.
00:01:48 Next, we have to specify the command to run the app.
00:01:51 In this case, cmd node hello.js will do the trick.
00:01:58 And now that we have created our Dockerfile, let's move into the folder where the Dockerfile is located by opening up the terminal and then running cd hello-docker.
00:02:11 Inside of here, let's type Docker.
00:02:13 build-t, and t stands for the tag, which is optional, and if no tag is provided, it defaults to the latest tag.
00:02:22 And finally, the path to the Docker file.
00:02:25 And in this case, that's hello-docker.
00:02:29 because we are right there.
00:02:31 And press enter.
00:02:33 It's building it, and I think it succeeded.
00:02:36 Great.
00:02:37 To verify that the image has been created or not, we can run a command Docker images.
00:02:44 And you can see that we have two images Ubuntu as well as Hello Docker created 16 seconds ago.
00:02:53 Now, if you're a more visual person, you can also visit Docker desktop.
00:02:58 Here, if you head to images, you can see all of the images we have created so far.
00:03:03 Now that we have our image, let's run or containerize it to see what happens.
00:03:09 So if we go back, we can run Docker, run hello-docker.
00:03:15 There we have it, an excellent console log.
00:03:20 If we go back to Docker desktop and then open up that container and navigate inside of the files, you'll see a lot of different files and folders,
00:03:32 but there is one special file here.
00:03:34 Wanna make a guess?
00:03:35 Yes, it's App, which we created in Dockerfile.
00:03:39 Moving inside it, we can see that it contains two of the same files we have in our application, Dockerfile and Hello.js,
00:03:47 exact replica.
00:03:48 Also, if we want to open up our application in shell mode, similar to what we did with Ubuntu, we have to run docker run.
00:03:57 IT hello-docker sh.
00:04:01 This puts us directly within the operating system, and then you can simply run node hello.js to see the same output.
00:04:11 We can also publish the images we have created on Docker, but before that, let's build something a bit more complex than the simple hello world,
00:04:20 and then let's publish it to the Docker Hub.
00:04:23 Which means that now we're diving into the real deal.
00:04:26 Dockerizing React.js applications.