run -it -v newvol2:temp --name ubuntocontainer ubuntu /bin/bash
after download some pkg with apt.
like tor. 13Mb
( in docker desktop show volume in use )
and exit from container.
but volume size is still 8kb
and when again start container
there is no tor pkg
why?
when i remove container with this command docker rm -f newub the newvol2 not in use
For installing software inside the container you will need to create a new image. This guide should be able to help you with that: https://docs.docker.com/get-started/02_our_app/#build-the-apps-container-image
i want open ubuntu in a container install some pkg and stop container and again can join into that. and move this ubunto into other machines. this article is about just nodejs program🤔
Start at the beginning of the docker tutorial. You don‘t know what docker is used for and how to use it properly. Packages are part of the image, they are not „data“ in that sense. You create the image you want (dockerfile/docker build or with the docker commit command if it‘s a „one time thing“) with all the packages you want (db etc), then you create the volume for the DB and mount it accordingly when starting the container based on your image. The tutorial is really nice. Just skimmed through it. It explains it quite well. Does not really matter if it‘s nodejs or any other program. Just replace nodejs with your database of choice.
aha what data can store in volume just database data?
Anythig. It’s just a folder on the host system. Instead of storing the data inside the container, you store it outside. You (basically) tell your software to store data inside „/etc/myapp/data“ and you tell docker that the folder „/etc/myapp/data“ is actually a volume (a mount point). So, docker will „link“ the internal folder to an external location where the data will be stored. Your software does not need know that. (I‘ve simplified some things, but it should be enough to get the gist)
Обсуждают сегодня