{"id":19318335,"url":"https://github.com/nimmis/docker-alpine-micro","last_synced_at":"2025-04-22T17:31:02.015Z","repository":{"id":3937861,"uuid":"51442949","full_name":"nimmis/docker-alpine-micro","owner":"nimmis","description":"microcontainer based on Alpine with working init process","archived":false,"fork":false,"pushed_at":"2021-12-08T12:53:58.000Z","size":56,"stargazers_count":54,"open_issues_count":4,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T02:05:31.035Z","etag":null,"topics":["alpine","docker","docker-container","minimal","runit"],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","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/nimmis.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}},"created_at":"2016-02-10T13:34:05.000Z","updated_at":"2023-10-04T16:52:16.000Z","dependencies_parsed_at":"2022-09-23T05:24:11.006Z","dependency_job_id":null,"html_url":"https://github.com/nimmis/docker-alpine-micro","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/nimmis%2Fdocker-alpine-micro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimmis%2Fdocker-alpine-micro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimmis%2Fdocker-alpine-micro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimmis%2Fdocker-alpine-micro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nimmis","download_url":"https://codeload.github.com/nimmis/docker-alpine-micro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250287456,"owners_count":21405617,"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":["alpine","docker","docker-container","minimal","runit"],"created_at":"2024-11-10T01:18:09.687Z","updated_at":"2025-04-22T17:31:01.363Z","avatar_url":"https://github.com/nimmis.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"## microcontainer based on Alpine with working init process\n[![](https://images.microbadger.com/badges/image/nimmis/alpine-micro.svg)](https://microbadger.com/images/nimmis/alpine-micro \"Get your own image badge on microbadger.com\")\n\nThis is a very small container (total 7.7 Mb) but still have a working init process, crond, syslog and logrotate. This is the base image for all my other microcontainers\n\n### Why use this image\n\nThe unix process ID 1 is the process to receive the SIGTERM signal when you execute a \n\n\tdocker stop \u003ccontainer ID\u003e\n\nif the container has the command `CMD [\"bash\"]` then bash process will get the SIGTERM signal and terminate.\nAll other processes running on the system will just stop without the possibility to shutdown correclty\n\n### runit init process\nIn this container runit is used to handle starting and shuttning down processes automatically started\n\n#### Adding your own startscript inside a container\n\nAdd a directory under the directory /etc/service/ that matches the process that should be started. Lets add a nginx start script to the container. First create the directory\n\n    mkdir /etc/service/nginx\n    \nand then create a file named `run` i that directory with the start code fpr nginx\n\n    #!/bin/sh\n    exec 2\u003e\u00261\n    exec /usr/sbin/nginx -c /etc/nginx/nginx.conf  -g \"daemon off;\"\n\nand make the file executable\n\n    chmod +x /etc/service/nginx/run\n\nthat command will be started automatically when the container is started. Be sure to start the command with flags that keeps it in the foreground otherwise runit will think that the process has ended and try to restart it.\n\n#### Adding it to the Dockerfile\n\nThe above example is done in a Dockerfile by creating a file i the same directory as the Dockerfile\nas nginx.sh containing the code\n\n    #!/bin/sh\n    exec 2\u003e\u00261\n    exec /usr/sbin/nginx -c /etc/nginx/nginx.conf  -g \"daemon off;\"\n\nand make the file executable\n\n    chmod +x nginx.sh\n    \nand add this lines to Dockerfile\n\n    ADD nginx.sh /etc/service/nginx/run\n\n#### Environment variables in start script\nIf you need environment variables from the docker command line (-e,--env=[]) add\n\n    source /etc/envvars\n    \nbefore you use them in the script file\n\nIn this container i have a scipt that handles the init process an uses the [supervisor system](http://supervisord.org/index.html) to start\nthe daemons to run and also catch signals (SIGTERM) to shutdown all processes started by supervisord. This is a modified version of\nan init script made by Phusion. I've modified it to use supervisor in stead of runit. There are also two directories to run scripts\nbefore any daemon is started.\n\n#### Run script once /etc/runonce\n\nAll executable in this directory is run at start, after completion the script is removed from the directory\n\n#### Run script every start /etc/runalways\n\nAll executable in this directory is run at every start of the container, ie, at `docker run` and `docker start`\n\n#### Permanent output to docker log when starting container\n\nEach time the container is started the content of the file /tmp/startup.log is displayed so if your startup scripts generate \nvital information to be shown please add that information to that file. This information can be retrieved anytime by\nexecuting `docker logs \u003ccontainer id\u003e`\n\n### cron daemon\n\nIn many cases there are som need of things happening att given intervalls, default no cron processs is started\nin standard images. In this image cron is running together with logrotate to stop the logdfiles to be\nto big on log running containers.\n\n### rsyslogd\n\nNo all services works without a syslog daemon, if you don't have one running those messages is lost in space,\nall messages sent via the syslog daemon is saved in /var/log/syslog\n\n### Docker fixes \n\nAlso there are fixed (besideds the init process) assosiated with running linux inside a docker container.\n\n### Installation\n\nThis continer should normaly run as a daemon i.e with the `-d` flag attached\n\n\tdocker run -d nimmis/alpine-micro\n\nAccessing the container with a shell can be done with\n\n\tdocker exec -ti \u003ccontainer ID\u003e /bin/sh\nThis is the commands used inside nimmis/alpine based containers\nfor extra functionality\n\n#### set_tz\n\nIn the default configuration Alpine is set to GMT time, if you need it\nto use the corret time you can change to timezone for the container \nwith this command, syntax is\n\n\tset_tz \u003ctimezone\u003e\n\nTo get list of available timezones do\n\n\tset_tz list\n\n\n##### set timezone on startup\n\nAdd the environment variable TIMEZONE to the desired timezone, i.e to set timezone to \nCET Stockhome\n\n\tdocker run -d -e TIMEZONE=Europa/Stockholm nimmis/alpine-micro\n\n##### set timezone in running container\n\nExecute the command on the container as\n\n\tdocker exec -ti \u003cdocker ID\u003e set_tz Europa/Stockholm\n\n##### get list of timezones before starting container\n\nExecute the following command, it will list available timezones and then\nremove the container\n\n\tdocker run --rm nimmis/alpine-micro set_tz list\n\n## Issues\n\nIf you have any problems with or questions about this image, please contact us by submitting a ticket through a [GitHub issue](https://github.com/nimmis/docker-alpine-micro/issues \"GitHub issue\")\n\n1. Look to see if someone already filled the bug, if not add a new one.\n2. Add a good title and description with the following information.\n - if possible an copy of the output from **cat /etc/BUILDS/*** from inside the container\n - any logs relevant for the problem\n - how the container was started (flags, environment variables, mounted volumes etc)\n - any other information that can be helpful\n\n## Contributing\n\nYou are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.\n\n## TAGs\n\nThis image only contains the latest versions of Apline, the versions are\nnimmis/alpine-micro:\u003ctag\u003e where tag is\n\n| Tag    | Alpine version | size |\n| ------ | -------------- | ---- |\n| latest |  latest/3.15    | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro.svg)](https://microbadger.com/images/nimmis/alpine-micro \"Get your own image badge on microbadger.com\") |\n| 3.15 |  3.15    | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.15.svg)](https://microbadger.com/images/nimmis/alpine-micro \"Get your own image badge on microbadger.com\") |\n| 3.14    |  3.14           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.14.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.14 \"Get your own image badge on microbadger.com\") |\n| 3.13    |  3.13           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.13.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.13 \"Get your own image badge on microbadger.com\") | \n| 3.12    |  3.12           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.12.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.12 \"Get your own image badge on microbadger.com\") |\n| 3.11    |  3.11           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.11.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.11 \"Get your own image badge on microbadger.com\") |\n| 3.10    |  3.10           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.10.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.10 \"Get your own image badge on microbadger.com\") |\n| 3.9    |  3.9           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.9.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.9 \"Get your own image badge on microbadger.com\") |\n| 3.8    |  3.8           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.8.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.8 \"Get your own image badge on microbadger.com\") |\n| 3.7    |  3.7           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.7.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.7 \"Get your own image badge on microbadger.com\") |\n\nDepicated (unsecure do not use)\n\n| Tag    | Alpine version | size |\n| ------ | -------------- | ---- |\n| 3.6    |  3.6           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.6.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.6 \"Get your own image badge on microbadger.com\") |\n| 3.5    |  3.5           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.5.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.5 \"Get your own image badge on microbadger.com\") |\n| 3.4    |  3.4           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.4.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.4 \"Get your own image badge on microbadger.com\") |\n| 3.3    |  3.3           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.3.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.3 \"Get your own image badge on microbadger.com\") |\n| 3.2    |  3.2           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.2.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.2 \"Get your own image badge on microbadger.com\") |\n| 3.1    |  3.1           | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:3.1.svg)](https://microbadger.com/images/nimmis/alpine-micro:3.1 \"Get your own image badge on microbadger.com\") |\n| edge   |  edge          | [![](https://images.microbadger.com/badges/image/nimmis/alpine-micro:edge.svg)](https://microbadger.com/images/nimmis/alpine-micro:edge \"Get your own image badge on microbadger.com\") |\n\n## Contributors\n\n - Maximilien Richer\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimmis%2Fdocker-alpine-micro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnimmis%2Fdocker-alpine-micro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimmis%2Fdocker-alpine-micro/lists"}