{"id":18326653,"url":"https://github.com/orhankupusoglu/docker-tetris","last_synced_at":"2025-04-06T00:31:36.785Z","repository":{"id":104229517,"uuid":"122791309","full_name":"OrhanKupusoglu/docker-tetris","owner":"OrhanKupusoglu","description":"Docker container for Tetris JavaScript game served with Flask","archived":false,"fork":false,"pushed_at":"2019-08-22T20:49:32.000Z","size":175,"stargazers_count":5,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T14:23:10.279Z","etag":null,"topics":["docker","docker-container","flask","tetris"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OrhanKupusoglu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-25T00:07:41.000Z","updated_at":"2024-12-11T17:34:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"922763e4-1e74-4354-a57d-aedc0ea86207","html_url":"https://github.com/OrhanKupusoglu/docker-tetris","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrhanKupusoglu%2Fdocker-tetris","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrhanKupusoglu%2Fdocker-tetris/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrhanKupusoglu%2Fdocker-tetris/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrhanKupusoglu%2Fdocker-tetris/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OrhanKupusoglu","download_url":"https://codeload.github.com/OrhanKupusoglu/docker-tetris/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419597,"owners_count":20936009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-container","flask","tetris"],"created_at":"2024-11-05T19:07:34.490Z","updated_at":"2025-04-06T00:31:32.522Z","avatar_url":"https://github.com/OrhanKupusoglu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker-Tetris\n\nThis project's aim is to combine [Docker](https://www.docker.com/) and a Web application by [Docker Compose](https://docs.docker.com/compose/). The selected Web applicatication is a beautifully crafted JavaScript game by [ytiurin](https://github.com/ytiurin). The [game](https://github.com/ytiurin/tetris) is a faithful simulation of the original Tetris of 1984.\n\nAlthough to host this game consisting of only static pages [Flask](http://flask.pocoo.org/) is an overkill, the main idea of using Docker containers might be useful for a real Flask application.\n\n\u0026nbsp;\n\n## Docker\n\nDocker is a [containerization](https://docs.docker.com/get-started/) tool. The free [Community Edition](https://www.docker.com/community-edition) is easy to [install](https://docs.docker.com/install/). The optional [post-installation steps](https://docs.docker.com/install/linux/linux-postinstall/) enable running Docker commands without root privileges.\n\n```\n$ sudo groupadd docker\n$ sudo usermod -aG docker $USER\n```\nLogout-login is required.\n\n\n### Docker Commands\n\nDocker images can be listed and removed with **docker image** family commands.\nFor more information check its manual pages.\n\n```\n$ man docker-image\n$ man docker-image-ls\n$ man docker-image-rm\n\n$ docker image ls\nREPOSITORY           TAG                 IMAGE ID            CREATED             SIZE\ntetris-server/app    0.0.5               5e8a2fc06b2c        14 minutes ago      595MB\ntetris-server/base   0.0.5               d2e0fbcc64b8        14 minutes ago      573MB\nubuntu               16.04               5e8b97a2a082        10 days ago         114MB\n```\n\nDocker containers can be listed and removed with **docker container** family commands.\nFor more information check its manual pages.\n\n```\n$ man docker-container\n$ man docker-container-ls\n$ man docker-container-rm\n\n$ docker container ls\n$ docker container ls\nCONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS              PORTS                                          NAMES\nec3939e3c083        tetris-server/app:0.0.5   \"sh -c /${DIR_PROJEC…\"   11 minutes ago      Up 11 minutes       0.0.0.0:8888-\u003e8888/tcp, 0.0.0.0:2222-\u003e22/tcp   app\n```\n\u0026nbsp;\n\n## Docker Compose\n\n[Docker Compose](https://docs.docker.com/compose/install/) uses [YAML](https://en.wikipedia.org/wiki/YAML) to define and run containers.\n\nWithout Docker Compose lengthy **docker build** and **docker run** commands must be issued. Another improvement is using arguments in the Dockerfile scripts. The important [FROM](https://docs.docker.com/engine/reference/builder/#from) instruction can contain references to arguments. See the scripts in the [docker/](./docker) directory.\n\nThe [.env](./docker/.venv) file contains variables, all starting with **X_**, which are then used in the [docker-compose.yml](./docker/docker-compose.yml) script.\n\n### Docker Compose Commands\n\nThe application can be built and run with a simple shell script, [docker.sh](./docker/docker.sh), which creates a [tarball](https://en.wikipedia.org/wiki/Tarball_(computing)) from the Flask web application. This tarball is referred to in the [Dockerfile-App](./docker/Dockerfile-App) script.\n\n```\n$ cd docker\n$ ./docker.sh\n. . .\nWARNING: Image for service app was built because it did not already exist. To rebuild this image you must use `dockerCreating docker_base_1 ... done\nCreating app ... done\nCreating app ... \nAttaching to app\napp     | ++ Flask App: tetris-server/app.py\napp     | ++ Flask HTTP port: 8888\napp     | ++ started\n```\n\nAfter running the Docker Compose scripts, three images are added. These images can be checked in a new terminal.\n\nThe **ubuntu:16:04** is the where **tetris-server/base** is derived from, and in turn the **tetris-server/app** image is derived from this base image. The **tetris-server/base** is prepared with Python 3 projects in mind and can be reached with SSH. Therefore this image might be useful for other Python 3 images, this means that build durations and storage requierements will be less than using directly a Linux distribution.\n\n```\n$ docker-compose help\n\n$ docker-compose ps\n    Name                   Command               State                       Ports                    \n------------------------------------------------------------------------------------------------------\napp             sh -c /${DIR_PROJECT}/start.sh   Up       0.0.0.0:2222-\u003e22/tcp, 0.0.0.0:8888-\u003e8888/tcp\ndocker_base_1   /bin/bash                        Exit 0                                               \n```\n\nThe running containers can be stopped with CTRL+C.\n\n```\napp     | ++ started\n^CGracefully stopping... (press Ctrl+C again to force)\nStopping app ... \nKilling app ... done\n```\n\n### Docker Compose Detached Mode\n\nDocker Compose has a **detached mode**:\n\n\u003e  -d Detached mode: Run containers in the background\n\nThis is useful to run containers as services.\n\n```\n$ docker-compose down\nRemoving app           ... done\nRemoving docker_base_1 ... done\nRemoving network docker_default\n\n$ docker-compose up -d\nCreating docker_base_1 ... done\nCreating app ... done\nCreating app ... \n\norhanku@OK-N752VX ~/ME/DEV/docker-tetris/docker $ docker-compose ps\n    Name                   Command               State                       Ports                    \n------------------------------------------------------------------------------------------------------\napp             sh -c /${DIR_PROJECT}/start.sh   Up       0.0.0.0:2222-\u003e22/tcp, 0.0.0.0:8888-\u003e8888/tcp\ndocker_base_1   /bin/bash                        Exit 0                                               \n```\n\n### Docker Compose Errors\n\nDuring development of new images with frequent ups and downs, Docker Compose may give errors related to its cache. When this is the case, it is best to remove all project containers (-f for force) and images and rebuild everything.\n\n```\n$ docker-compose up\n. . .\nERROR: Error: image \u003cIMAGE_NAME/TAG\u003e not found\n\n$ docker ps -a\nCONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS                     PORTS                                          NAMES\nec3939e3c083        tetris-server/app:0.0.5    \"sh -c /${DIR_PROJEC…\"   6 minutes ago       Up 6 minutes               0.0.0.0:8888-\u003e8888/tcp, 0.0.0.0:2222-\u003e22/tcp   app\ndd419b6ad532        tetris-server/base:0.0.5   \"/bin/bash\"              6 minutes ago       Exited (0) 6 minutes ago                                                  docker_base_1\n\n$ docker container rm -f ec3939e3c083 dd419b6ad532\n\n$ docker image ls\nREPOSITORY           TAG                 IMAGE ID            CREATED             SIZE\ntetris-server/app    0.0.5               5e8a2fc06b2c        10 minutes ago      595MB\ntetris-server/base   0.0.5               d2e0fbcc64b8        10 minutes ago      573MB\nubuntu               16.04               5e8b97a2a082        10 days ago         114MB\n\n$ docker image rm 5e8a2fc06b2c d2e0fbcc64b8 5e8b97a2a082\n```\n\u0026nbsp;\n\n## SSH\n\nThe container can be accessed via SSH on port **2222** by the **root** user with password **1234**.\n\n```\n$ ssh root@localhost -p 2222\nThe authenticity of host '[localhost]:2222 ([127.0.0.1]:2222)' can't be established.\nECDSA key fingerprint is SHA256:m7YdkesND8QU+NV3oxdvDFqCLCvld6aG58egNVJkGK4.\nAre you sure you want to continue connecting (yes/no)? yes\nWarning: Permanently added '[localhost]:2222' (ECDSA) to the list of known hosts.\nroot@localhost's password: \nWelcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.10.0-38-generic x86_64)\n\n * Documentation:  https://help.ubuntu.com\n * Management:     https://landscape.canonical.com\n * Support:        https://ubuntu.com/advantage\n\nThe programs included with the Ubuntu system are free software;\nthe exact distribution terms for each program are described in the\nindividual files in /usr/share/doc/*/copyright.\n\nUbuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by\napplicable law.\n\nroot@app:~# cd /GAME/\nroot@app:/GAME# ls -1F\nrequirements.txt\nsettings.cfg\nstart.sh*\nstop.sh*\ntetris-server/\n```\n\nEach new built image may trigger a warning. This warning can be eliminated with the suggested **ssh-keygen -f** command.\n```\n$ ssh root@localhost -p 2222\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\nIT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\nSomeone could be eavesdropping on you right now (man-in-the-middle attack)!\nIt is also possible that a host key has just been changed.\nThe fingerprint for the ECDSA key sent by the remote host is\nSHA256:H/lsgpyZSReSu7krJGKvHAwJA3W83cldDrebk6OTav4.\nPlease contact your system administrator.\nAdd correct host key in /home/user/.ssh/known_hosts to get rid of this message.\nOffending ECDSA key in /home/user/.ssh/known_hosts:2\n  remove with:\n  ssh-keygen -f \"/home/user/.ssh/known_hosts\" -R [localhost]:2222\nECDSA host key for [localhost]:2222 has changed and you have requested strict checking.\nHost key verification failed.\n\n$ ssh-keygen -f \"/home/user/.ssh/known_hosts\" -R [localhost]:2222\n\n$ ssh root@localhost -p 2222\n```\n\n\u0026nbsp;\n\n## Game Page\n\nThe game page can be reached at [http://localhost:8888/tetris](http://localhost:8888/).\n\nThis page is also hosted at [GitHub](https://ytiurin.github.io/tetris/).\n\n\u0026nbsp;\n\n## Server Logs\n\nThe server logs of a running Tetris container can be checked online at [http://localhost:8888/log](http://localhost:8888/log).\n\n\u0026nbsp;\n\n## Favicon\n\nThe included [favicon icon](https://en.wikipedia.org/wiki/Favicon.ico) by [Double-J Design](http://www.iconarchive.com/show/origami-colored-pencil-icons-by-double-j-design/green-plus-icon.html) prevents annoying 404-NOT FOUND errors.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forhankupusoglu%2Fdocker-tetris","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forhankupusoglu%2Fdocker-tetris","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forhankupusoglu%2Fdocker-tetris/lists"}