-
Notifications
You must be signed in to change notification settings - Fork 46
Running with Docker on any OS
"Docker" provides a way to run the program code in a self-contained container, irrespective of the operating system. Follow the steps below, with due variations depending on your OS.
Obviously 😄
Windows or Mac : https://www.docker.com/products/docker-desktop
Ubuntu / other : Lookup guides on the net. Here are two: docs.docker.com, linux.com
Get your Terminal / Command prompt to the program folder.
Run this command to "build" the docker application. You can think of this as an installation.
docker build -t static-gtfs-manager .
Note: don't miss the dot (.) at the end! That's for telling docker that the current directory is the source of the code.
It will take some time, especially if doing the first time. Screenshot:
After that has happened, we can now run the application.
On Mac or Ubuntu/Linux:
docker run -it -p 5000:5000 -v "`pwd`":/app static-gtfs-manager
On Windows:
docker run -it -p 5000:5000 -v "%cd%":/app static-gtfs-manager
-
docker run -it
: normal stuff -
-p 5000:5000
: which port on your side will map to port 5000 of the program running in docker image. You can change the number on left side as per convenience. -
-v "[full path]":/app
: This is very important to make sure you don't lose all your work! By default, docker runs with a "RAM" like memory: the database, even though telling on front end that it's been saved, gets reset to "factory setting" every time we run the program again. -
- The -v key tells it to keep a local persistent storage of all changes done.
-
- The left side before the
:
tells that your program folder location is the place to do persistent storage at.
- The left side before the
-
- You can use another namespace instead of your program folder, like
-v persistent:/app
for example, but then where that data is located depends on the system installation, and it's up to you to make sure you don't lose your db suddenly. (issues posted in this regard will get a 'wontfix' label!)
- You can use another namespace instead of your program folder, like
-
- The right side refers to the generic app location in the container.
/app
contains the whole program.
- The right side refers to the generic app location in the container.