{"id":19993752,"url":"https://github.com/hopher/dockerfiles","last_synced_at":"2026-01-16T05:48:01.967Z","repository":{"id":183383218,"uuid":"173913246","full_name":"hopher/dockerfiles","owner":"hopher","description":"docker build nginx/php/mysql/redis/go","archived":false,"fork":false,"pushed_at":"2023-07-24T07:40:06.000Z","size":583,"stargazers_count":29,"open_issues_count":0,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-13T04:57:10.085Z","etag":null,"topics":["docker","docker-compose","dockerfile","golang","mvn","mysql","nginx","php","redis"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/hopher.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":"2019-03-05T09:11:35.000Z","updated_at":"2024-01-30T01:54:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"5d3fd8ba-e630-48ae-8d7a-05fc4b433224","html_url":"https://github.com/hopher/dockerfiles","commit_stats":null,"previous_names":["hopher/dockerfiles"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopher%2Fdockerfiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopher%2Fdockerfiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopher%2Fdockerfiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hopher%2Fdockerfiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hopher","download_url":"https://codeload.github.com/hopher/dockerfiles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252335131,"owners_count":21731523,"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-compose","dockerfile","golang","mvn","mysql","nginx","php","redis"],"created_at":"2024-11-13T04:52:58.033Z","updated_at":"2026-01-16T05:48:01.945Z","avatar_url":"https://github.com/hopher.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"# Dockerfiles\n\n用 Docker 容器服务的方式搭建 nginx/php/mysql/redis/go/node 环境，易于维护、升级。\n\n## 配置\n\n你可以通过复制 \u0026\u0026 修改 .env.example 来自定义构建项目组合\n\n示例: \n```\ncp .env.example .env\nvi .env\n```\n\n## 使用\n\n进入项目所在目录：\n执行命令：\n```\ndocker-compose up\n```\n\n如果没问题，下次启动时可以以守护模式启用，所有容器将后台运行：  \n```\ndocker-compose up -d\n``` \n\n使用 docker-compose 基本上就这么简单，Docker 就跑起来了，用 stop，start 关闭开启容器服务。  \n更多的是在于编写 dockerfile 和 docker-compose.yml 文件。 \n\n可以这样关闭容器并删除服务：\n```\ndocker-compose down\n```\n\n### 3. 测试\n\n将项目源码放到 `~/app` 目录下, 并运行\n\n```\ncd src\necho \"\u003c?php phpinfo();\" \u003e index.php\n```\n\n打开 url 访问 `http://localhost/index.php`\n\n### 4. 常用指令\n\n- 帮助\n    ```\n    docker-compose --help\n    ```\n- 列出网络 (包括跨群集中多个主机的网络)\n    ```\n    docker network ls\n    ```\n- 运行时，指定配置文件  \n    ```\n    docker-compose -p java -f docker-compose-tomcat.yml up -d\n    ```\n    **参数**:\n    - `-p` 工程名称, 这里为 java, 代表java 相关配置\n    - `-f` 配置文件\n    - `-d` 后台运行\n\n- 常用`shell`组合\n\n    ```\n    # 删除所有容器\n    docker stop `docker ps -q -a` | xargs docker rm\n\n    # 删除所有标签为none的镜像\n    docker images|grep \\\u003cnone\\\u003e|awk '{print $3}'|xargs docker rmi\n\n    # 查找容器IP地址\n    docker inspect 容器名或ID | grep \"IPAddress\"\n\n    # 创建网段, 名称: mynet, 分配两个容器在同一网段中 (这样子才可以互相通信)\n    docker network create mynet\n    docker run -d --net mynet --name container1 my_image\n    docker run -it --net mynet --name container1 another_image\n    ```\n\n\u003e 更多帮助信息 `docker-compose -h|--help`      \n\n### 5. 目录结构\n\n```\ndockerfiles\n    |-- services                    # docker 相关服务\n    |-- **.yml                      # 通用配置文件\n    |-- mirrors                     # source.list 镜像源地址\n~/app                               # 工作源码存放目录\n```\n\n\n## Version 3 (docker-composer) 不再支持参数说明\n\n**depends_on**\n\n\u003e 笔者解读: 通过配置 `networks` 参数更好地改进\n\n- `depends_on` does not wait for `db` and `redis` to be “ready” before starting `web` - only until they have been started. If you need to wait for a service to be ready, see [Controlling startup order](https://docs.docker.com/compose/startup-order/) for more on this problem and strategies for solving it.\n- Version 3 no longer supports the `condition` form of `depends_on`.\n- The `depends_on` option is ignored when [deploying a stack in swarm mode](https://docs.docker.com/engine/reference/commandline/stack_deploy/) with a version 3 Compose file.\n\n\u003e @https://docs.docker.com/compose/compose-file/\n\n**links**\n\n**Warning**: The `--link` flag is a legacy feature of Docker. It may eventually be removed. Unless you absolutely need to continue using it, we recommend that you use [user-defined networks](https://docs.docker.com/engine/userguide/networking//#user-defined-networks) to facilitate communication between two containers instead of using `--link`. One feature that user-defined networks do not support that you can do with `--link` is sharing environmental variables between containers. However, you can use other mechanisms such as volumes to share environment variables between containers in a more controlled way.\n\n\n## 各系统软件源\n\n### Ubuntu\n\n| 系统代号 | 版本  |\n| -------- | ----- |\n| precise  | 12.04 |\n| trusty   | 14.04 |\n| vivid    | 15.04 |\n| xenial   | 16.04 |\n| zesty    | 17.04 |\n\n### Debian\n\n| 系统代号 | 版本 |\n| -------- | ---- |\n| squeeze  | 6.x  |\n| wheezy   | 7.x  |\n| jessie   | 8.x  |\n| stretch  | 9.x  |\n| buster   | 10.x |\n\n\u003e **NOTE**:  \n\u003e 查询自己的Linux版本 `cat /etc/issue`\n\n## git ssh 密钥配置\n\nFor your host machine which run git, all the contents of `git config --list` is stored in files:\n\n- If use `git config --system` to configure them, they are stored in `/etc/gitconfig`\n- If use `git config --global` to configure them, they are stored in `~/.gitconfig`\n\n\u003e @https://stackoverflow.com/questions/52819584/copying-local-git-config-into-docker-container\n\u003e @https://github.com/tomwillfixit/atomci/blob/master/docker-compose.yml\n\n示例: \n```\nvolumes:\n    # Git and ssh config\n    - ~/.ssh:/root/.ssh:ro # Change - ssh key needed to push to github\n    - ~/.gitconfig:/root/.gitconfig:ro  # Change - git config needed for user details\n    #- /tmp/ssh_auth_sock:/tmp/ssh_auth_sock #Static - needed to push to github without prompt\n```\n\n## 贡献名单\n\n.... 期待你的留名 ....\n\n##  参考资料\n- [[官方文档] Dockerfile reference](https://docs.docker.com/engine/reference/builder/)\n- [[官方文档] Compose file version 3 reference](https://docs.docker.com/compose/compose-file/)\n- [[官方文档] Use volumes](https://docs.docker.com/storage/volumes/)\n- [[官方文档] env-file](https://docs.docker.com/compose/env-file/)\n- [[镜像] mysql 镜像说明](https://hub.docker.com/_/mysql/)\n- [[镜像] php 镜像说明](https://hub.docker.com/_/php/)\n- [[镜像站] 阿里云开源镜像站](https://opsx.alibaba.com/mirror)\n- [[镜像站] 腾讯开源镜像站](https://mirrors.cloud.tencent.com/index.html)\n- [[镜像站] 网易开源镜像站](http://mirrors.163.com/)\n- [[镜像站] 清华大学开源软件镜像站](https://mirrors.tuna.tsinghua.edu.cn/help/debian/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhopher%2Fdockerfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhopher%2Fdockerfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhopher%2Fdockerfiles/lists"}