This article is showing how to run a new docker container. Not only running a docker container but also mounting a directory exist in Microsoft Windows. By mounting that directory, it will be available for further access and execution in the operating system exist in the docker container. Before it is possible for running the docker container, just check the image first by typing the following command :
C:\Users\Administrator>docker image list REPOSITORY TAG IMAGE ID CREATED SIZE 0f55d0a99324 7 days ago 231MB registry latest b8604a3fe854 11 days ago 26.2MB bash latest bacfc038bc2c 11 days ago 12.9MB hub.docker.local:5000/centos_sinergi latest 5d0da3dc9764 2 months ago 231MB centos latest 5d0da3dc9764 2 months ago 231MB C:\Users\Administrator>
Using the image exist or available above, just execute a command to run a new docker container. That new docker container will use the image exist or available as in the previous output command execution.
Run Docker Container
After displaying the docker image available as in the previous part, just execute a specific command to run a new docker container. Moreover, it is a docker container which has its specific folder mounted to the host or local machine. In this context, the host or the local machine which the docker container run is using Microsoft Windows. That specific folder which is mounted in this article will be the nginx root document folder. It is using ‘/var/www’ where the mounted folder in Microsoft Windows is in ‘C:\django\web\project’. So, the command execution to achieve it exist as follows :
C:\django\web\project>docker run -it --mount "type=bind,source=C:\\django\\web\\project,target=/var/www" centos bash [root@0bf86c236317 /]# cd /var/www/ [root@0bf86c236317 www]# ls CHANGELOG.md LICENSE.md README.md apps db.sqlite3 gunicorn-cfg.py media navigator requirements.txt sinergi Dockerfile Procfile app.yaml core docker-compose.yml manage.py models2.py package.json runtime.txt staticfiles [root@0bf86c236317 www]#