Prerequisites: Docker Engine.
check the docker-compose.yaml if you'd need to have different username and password and db name other than My* please edit those.
To run the server then you need this command.
$ docker-compose up
If this is the first time using Docker, install the Docker Desktop.
Check your Docker Desktop version by clicking the the Docker Desktop icon in the taskbar to show the drop-down menu, and open About Docker Desktop.
This will show the Docker Desktop version in the middle of the window, the Engine version below, and other version numbers.
Compare your version numbers to the following:
Recommended Docker Desktop version: 2.1.0Recommended Engine version: 19.03
If you have version(s) lower than the above version numbers, update Docker Desktop. This can easily be done by clicking the Docker Desktop icon in the taskbar to show the drop-down menu, then Check for Updates.
- Stop a container:
- Use
docker psto list running containers. - Copy the name of the Image (under the Names column)
- Use the Terminal command
docker stop your-image-name - When the container is successfully stopped, Docker will print the name of the Image in the terminal
- Use
- Remove unused containers:
- Use the Terminal command
docker system prune(followed byyto confirm) to remove all of the old and unused containers. - It is recommended you do this after
docker stoping a container - This will NOT remove the Images, which means you only need to enter your specific
docker run ...command that you used in Run Server Docker Image when you want to use the simulator again.
- Use the Terminal command
- List images built successfully: use the Terminal command
docker images. - If your container is spontaneously dying, it may be due to the memory allocation given to Docker.
Docker Desktop -> Preferences -> Advancedand adjust the slider settings to allow Docker to use more resources.
docker ps: list running containers- copy the simserver container named
nifty_murdocklisted in the last column, Names docker stop nifty_murdock: stops the containerdocker system prunethenywhen asked to confirm: deletes old container and reclaims space (Terminal responses are green)
username:/ username$ docker ps
+ CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+ 119de3df985d simserver "python server.py" 14 seconds ago Up 12 seconds 0.0.0.0:5000->5000/tcp nifty_murdock
username:/ username$ docker stop nifty_murdock
+ nifty_murdock
username:/ username$ docker system prune
+ WARNING! This will remove:
+ - all stopped containers
+ - all networks not used by at least one container
+ - all dangling images
+ - all dangling build cache
Are you sure you want to continue? [y/N] y
+ Deleted Containers:
+ 119de3df985ddce4bee7d12899896ec66a72c9768cebe347df8303eba38e71ad<https://linuxhint.com/run_postgresql_docker_compose/>