{"id":25668457,"url":"https://github.com/borud/volume","last_synced_at":"2025-09-04T05:50:27.679Z","repository":{"id":149427034,"uuid":"470651745","full_name":"borud/volume","owner":"borud","description":"tiny dockerized image with volume demo","archived":false,"fork":false,"pushed_at":"2022-03-16T15:59:49.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-20T22:19:26.566Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/borud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-03-16T15:54:20.000Z","updated_at":"2022-03-16T15:58:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"2489a009-6d64-402c-a9b7-04aa696238a7","html_url":"https://github.com/borud/volume","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/borud%2Fvolume","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fvolume/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fvolume/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fvolume/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borud","download_url":"https://codeload.github.com/borud/volume/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240462481,"owners_count":19805291,"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":[],"created_at":"2025-02-24T10:34:01.756Z","updated_at":"2025-02-24T10:34:02.474Z","avatar_url":"https://github.com/borud.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tiny dockerized image with volume demo\n\nThe instructions below use docker commands.  There are equivalent commands in the Makefile to exemplify how you can structure this in your own projects.\n\nIf the SQLite database does not already exist on the volume the container mounts it creates the database and defines the schema.  If a database already exist it is just opened and used.\n\nThe application just logs the timestamp in milliseconds since epoch to the database every 5 seconds.  If you access \u003chttp://localhost:8080\u003e it will just give you a JSON array of the values that have been written to the database.\n\nExperiment with starting and shutting down the docker container.  Even removing the container and re-creating it.\n\n## Build the docker image\n\n```shell\ndocker build -t app .\n```\n\n## Create volume\n\nCreate a volume for your application.  This will be persistent across invocations. This happens on the host machine where you run the docker container.  Think of it like creating a directory.\n\n```shell\ndocker volume create app-db\n```\n\n## Start the container\n\nYou can choose to run the container interactively:\n\n```shell\ndocker run -ti --name app-container -p 8080:8080 -v app-db:/var/lib/db app\n```\n\n...or you can run it in the background:\n\n```shell\ndocker run -d --name app-container -p 8080:8080 -v app-db:/var/lib/db app\n```\n\nNote that `app-db` is specified as the volume we are going to use and `/var/lib/db` is the mount point inside the container.  Also note that the syntax\n\n```shell\n-v something:/var/lib/db\n```\n\n...can be confusing since `something` could refer to your local filesystem or to a volume.  When you use the local filesystem this is called a *bind mount* and you should really make your intentions explicit by using the `--mount` option.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborud%2Fvolume","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborud%2Fvolume","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborud%2Fvolume/lists"}