It is what it is. I thought docker is one complex course after watching a 5 hours video. It was nice till I ran into Net Ninja, your tutorials are just spectacular
The second -v flag (-v /app/node_modules) mounts a volume (Docker internal volume) at the /app/node_modules directory inside the container. This is done to avoid overwriting the node_modules directory with the local version. Mounting a volume here means that the local node_modules directory will not be used, and the image's built-in node_modules will be preserved.
So this has been bordering me for a while. What do you do when you want to install packages or uninstall packages as you develop you application. If the node_modules on you host is not in sync with the one in the container?
When running a command to use volumes I'm getting an error docker: Error response from daemon: mkdir C:UserssamokDesktopdocker-ninjaapi: Access is denied. UPD: This is because the \ character has a special meaning in Git Bash. If you are using Git Bash, you must neutralize it using \\:
for anyone getting the same error, if you're using gitbash as default vscode terminal then just use /$(pwd) instead of copy the path as shown in the video.
@@alcymn Thank you so much! I just opened a normal powershell terminal in VS code and it worked flawlessly! 😇 And I was also almost about to give up 🤪 It actually didn't work for me in the bash terminal in vs code, (on windows) got the following error: "docker: Error response from daemon: mkdir C:\Program Files\Git\;C: Access is denied." (gave permission to all users in windows, still didn't work)
Third tutorial I watch and I simply couldn't solve the fact the container was simply not mapping to the host, just because of a freaking /... Thanks Alexander for your comment, you saved me a lot of stress, more than I already accumulated haha
I got error when I use -v, showed syntax error. I put the path after -v in double quotes, then fix the error. Hopefully can help some of you. And we can delete node_modules from our app as well. Docker use the modules inside image
Are there any pros/cons of implementing the "nodemon app.js" command as a script in the package.json file versus specifying it directly in the CMD instruction of the Dockerfile, or is it more a matter of style or preference?
I run into an error : "Unable to find image :locally' because there were whitespace in my absolute path after -v tag. So to remove this error, make sure there is no space in folder name in your absolute path. It will fix the problem. hope it helps and the tutorial is awesome!!!
Does dockerignore file is ignore when we are using volumes? For example if we have placed a folder in dockerignore file but it has been mapped using volumes. Does the folder will be mapped or since it is in dockerignore it will be ignore because it was not copied to the during the image build?
If everything is mirrored to the container using volumes so does it meant that dockerignore which avoids some folders to be copied to the image so that folders are now also the inside the container?
I tried removing the "node_modules" folder in the directory, and not creating a volume for it. But, when the container is created and started, the app crashes... showing the error "Error: Cannot find module 'express''"... Is it still necessary use "-v /app/node_modules" even when we do not have the node_modules folder in our host directory? Why?
I am confused, this just seems to be uploading what is inside the api folder locally to the container folder, what does this have to do with peristent storage?
when you write the sevond volume "-v /app/node_modules" and explained that this creates some folder in our host and maps to it for next runs(16:25). BUT you also use "--rm" which deletes the container after stop, so how can it run the second time as well if after stop its deleted? and what happened with the folder in our host after stop?
I have one problem with the -v using the absolute path. that does not work on my mac. for some reason, it puts a "/host_mnt" in front of my absolute path. Do you have an idea?
For anyone dealing with the error message: "Error response from daemon: error while creating mount source path ... mkdir file exists", just restart docker desktop and it should go away : )
Nodemon has an issue, when a crash will happen then nodemon will still continue and not stop. This is why i believe nodemon shouldn't be used here in docker
hopefully you still watch these comments. First of all thanks a mil! for doing these vids! I ran into an issue with COPY: WORKDIR /var/www COPY index.html . COPY hello.html . => => transferring context: 29B 0.0s => CACHED [2/6] RUN apt-get -y update && apt-get -y install nginx 0.0s => CACHED [3/6] COPY default /etc/nginx/sites-available/default 0.0s => CACHED [4/6] WORKDIR /var/www 0.0s => CACHED [5/6] COPY index.html . 0.0s => ERROR [6/6] COPY hello.html . If I do a COPY . . I get the Dockerfile and default file copied over to the /var/www but NOT the html files. What am I doing wrong? If I use COPY *.html . it builds OK but when I then ls the /var/www I get # ls /var/www Dockerfile default Cheers!
This teaching style is great, it shows every detail you need to know, make you really understand it.
Thank you :) that means a lot
It is what it is. I thought docker is one complex course after watching a 5 hours video. It was nice till I ran into Net Ninja, your tutorials are just spectacular
Great to hear Ikhlas!
He’s blessed. He’s the best
Thank you for putting so much effort in your videos to make them as much clear as possible
The second -v flag (-v /app/node_modules) mounts a volume (Docker internal volume) at the /app/node_modules directory inside the container. This is done to avoid overwriting the node_modules directory with the local version. Mounting a volume here means that the local node_modules directory will not be used, and the image's built-in node_modules will be preserved.
So this has been bordering me for a while. What do you do when you want to install packages or uninstall packages as you develop you application. If the node_modules on you host is not in sync with the one in the container?
@@isidorenwaiwu2793 create a new image i suppose
I was searching for docker volumes today. Thanks Shaun!
When running a command to use volumes I'm getting an error docker: Error response from daemon: mkdir C:UserssamokDesktopdocker-ninjaapi: Access is denied.
UPD: This is because the \ character has a special meaning in Git Bash. If you are using Git Bash, you must neutralize it using \\:
this comment is underrated!
for anyone getting the same error, if you're using gitbash as default vscode terminal then just use /$(pwd) instead of copy the path as shown in the video.
@@alcymn Thank you very much for this. I was about to give up on it
@@alcymn Thank you so much!
I just opened a normal powershell terminal in VS code and it worked flawlessly! 😇
And I was also almost about to give up 🤪
It actually didn't work for me in the bash terminal in vs code, (on windows) got the following error: "docker: Error response from daemon: mkdir C:\Program Files\Git\;C: Access is denied." (gave permission to all users in windows, still didn't work)
Third tutorial I watch and I simply couldn't solve the fact the container was simply not mapping to the host, just because of a freaking /... Thanks Alexander for your comment, you saved me a lot of stress, more than I already accumulated haha
amazing!!! i heart docker now .. thanks for explaining very easily and well!!! kudos
Glad it helped! thanks Kuri :)
Please include docker in your future full stack videos. Thank you
Everything works, Hallelujah 😂😂 Never heard that one before.
Thank you. Very clear and interesting even if this last video gave me a bit headache :D
I got error when I use -v, showed syntax error. I put the path after -v in double quotes, then fix the error. Hopefully can help some of you. And we can delete node_modules from our app as well. Docker use the modules inside image
thanks. it works like charm ^^
dude you just solved problem that I been stuck for hours on thanks 🤗
Hi Shaun... can you please do a full dockerfide web application wih mySQL build and maybe a host file server volume config files? :) love your channel
Brilliant playlist.
Are there any pros/cons of implementing the "nodemon app.js" command as a script in the package.json file versus specifying it directly in the CMD instruction of the Dockerfile, or is it more a matter of style or preference?
Hi Ninja, it was awesome tutorial, small request , can you please do tutorial on deploying it to aws?
And one on deploying to Azure
I run into an error : "Unable to find image :locally' because there were whitespace in my absolute path after -v tag. So to remove this error, make sure there is no space in folder name in your absolute path. It will fix the problem. hope it helps and the tutorial is awesome!!!
Thank you!
Thanks brother! Helped me
Does dockerignore file is ignore when we are using volumes? For example if we have placed a folder in dockerignore file but it has been mapped using volumes. Does the folder will be mapped or since it is in dockerignore it will be ignore because it was not copied to the during the image build?
If everything is mirrored to the container using volumes so does it meant that dockerignore which avoids some folders to be copied to the image so that folders are now also the inside the container?
With volume and all our local files mapped with container /app directory, is "COPY . ." layer still necessary ? Thanks in advance
Really nice way of explaining by example.
I tried removing the "node_modules" folder in the directory, and not creating a volume for it. But, when the container is created and started, the app crashes... showing the error "Error: Cannot find module 'express''"...
Is it still necessary use "-v /app/node_modules" even when we do not have the node_modules folder in our host directory? Why?
I had the same problem,. I dont understand why I need to have the second volume when it doesnt exist on the host
I am confused, this just seems to be uploading what is inside the api folder locally to the container folder, what does this have to do with peristent storage?
Got error !! error Couldn't find a package.json file in "/app"
same here can any body help
The part when he said everything is working fine hallielulliwya was comedy
when you write the sevond volume "-v /app/node_modules" and explained that this creates some folder in our host and maps to it for next runs(16:25). BUT you also use "--rm" which deletes the container after stop, so how can it run the second time as well if after stop its deleted? and what happened with the folder in our host after stop?
Thank you very much
When running a command to use volumes I'm getting an error docker: Error response from daemon: invalid mode: /app.
What's the difference of using Docker vs. using an all around version manager like asdf, for development?
I have one problem with the -v using the absolute path. that does not work on my mac. for some reason, it puts a "/host_mnt" in front of my absolute path. Do you have an idea?
Everything runs Halleluyah! lol! Nice tutorial
Awesome :) thanks for watching!
For anyone dealing with the error message: "Error response from daemon: error while creating mount source path ... mkdir file exists", just restart docker desktop and it should go away : )
Please do a course on traefik
what if I add new node_modules, would the code break?
Nodemon has an issue, when a crash will happen then nodemon will still continue and not stop. This is why i believe nodemon shouldn't be used here in docker
CMD looks funny, array of three strings xd
👍👍
10:41 😂
compose ile halledeceksek niye anlattin oe
Waw
Your content, in this video, is pretty confusing; pretty painfull.
My opinion about this serie is that it's lower quality than usual.
have you seen a better docker course somewhere? I've checked the laracasts one, this one is better
this is a good docker course
This video is 4 minutes about volumes and 12 minutes about everything else from nodemon to images and containers LOL. Thanks for wasting my time.
x)
Bro, you keep repeating yourself a thousand times throughout the video.
hopefully you still watch these comments. First of all thanks a mil! for doing these vids!
I ran into an issue with COPY:
WORKDIR /var/www
COPY index.html .
COPY hello.html .
=> => transferring context: 29B 0.0s
=> CACHED [2/6] RUN apt-get -y update && apt-get -y install nginx 0.0s
=> CACHED [3/6] COPY default /etc/nginx/sites-available/default 0.0s
=> CACHED [4/6] WORKDIR /var/www 0.0s
=> CACHED [5/6] COPY index.html . 0.0s
=> ERROR [6/6] COPY hello.html .
If I do a COPY . . I get the Dockerfile and default file copied over to the /var/www but NOT the html files. What am I doing wrong?
If I use COPY *.html . it builds OK but when I then ls the /var/www I get
# ls /var/www
Dockerfile default
Cheers!