{"id":15443389,"url":"https://github.com/0xff-dev/docker-playground","last_synced_at":"2025-03-28T07:41:05.100Z","repository":{"id":104624991,"uuid":"150278297","full_name":"0xff-dev/docker-playground","owner":"0xff-dev","description":"学习 docker","archived":false,"fork":false,"pushed_at":"2020-01-12T17:39:30.000Z","size":2025,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T08:27:32.910Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/0xff-dev.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":"2018-09-25T14:24:28.000Z","updated_at":"2020-01-12T17:39:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"89efe6a7-6c00-4ec4-8c28-08a168ec1b50","html_url":"https://github.com/0xff-dev/docker-playground","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/0xff-dev%2Fdocker-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xff-dev%2Fdocker-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xff-dev%2Fdocker-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xff-dev%2Fdocker-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xff-dev","download_url":"https://codeload.github.com/0xff-dev/docker-playground/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991561,"owners_count":20706125,"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":"2024-10-01T19:34:46.882Z","updated_at":"2025-03-28T07:41:05.095Z","avatar_url":"https://github.com/0xff-dev.png","language":"C","readme":"# docker-playground\n\n\n# 知识点\n### 基本名词\n* 镜像\n* 容器\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;从镜像中构建容器，等同 从快照里构建虚拟机\n* 数据卷\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;不受容器生命周期的限制，进行数据持久化,在容器内占用空间, 实际保存在容器之外. 容器之间共享数据.\n* 链接\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;创建一个新的容器的时候，引用别的容器，被引用的容器获得别名，则两个容器链接在一起\n\n### Docker 组件\n* docker client 支持用户与docker daemon通信\n* docker Daemon 运行在主机上，处理服务请求\n* docker index 中央registry，支持拥有共有和私有访问权限的Docker容器镜像的备份\n\n### Docker要素\n* Docker Containers 负责程序的运行, 包括操作系统，用户添加的文件以及元素数\n* Docker images 只读模板，运行docker的容器\n* Dockerfile 文件的指令集，如何自动构建docker镜像\n\n### 基本的Docker命令\n1. docker info\n2. docker pull image\n3. docker run xx\n\u003e -d 后台运行\n4. docker logs 查看当前job的日志\n5. docker start/stop/restart/rm job\\_name Start/Stop/Restart/reomove one or more running containers\n6. docker commit $container imgae_name 将容器保存为镜像 [a-z0-9]\n7. docker search/history image_name 查找镜像/查看镜像的历史版本\n8. docker build [options] PATH|URL(指定上下文环境)\n\u003e --rm=true   构建成功后，移除所有中间容器\n\u003e --no-cache=true 不使用缓存\n9. docker attach container 与运行中的容器进行交互 \n10. docker diff 列出容器内发生变化的文件目录,\n11. docker events  打印指定时间内的容器实时系统事件\n12. docker import/export 导入/导出\n13. docker cp container:file_path hostpath\n14. docker login 登录\n15. docker inspect 收集容器和镜像的底层信息(容器实例的ip，端口绑定列表，特定端口映射搜索, 收集配置信息)\n16. docker kill  发送SIGKILL 停止容器的主进程\n17. docker rmi 删除一个或者多个镜像\n18. docker wait \n19. docker load/save  从tar文件在如镜像, 保存镜像到tar文件\n\n### 学写Dockerfile\n1. Dockerfile以FROM 命令开始，指定使用的基础镜像\n  * FROM \u003cimage_name\u003e   FROM ubuntu  \n  * MAINTAINER \u003cauther_name\u003e  设置该镜像的作者  \n  * RUN \u003ccommand\u003e    在shell/exec环境下执行的命令  \n  * ADD \u003csrc\u003e  \u003cdestination\u003e  复制文件指令, 两个参数\u003csource\u003e这个可以是url或者启动配置上下文中的一个文件， \u003cdestination\u003e容器内的路径  \n  * CMD 提供容器的默认执行命令, Dockerfile只允许使用一次CMD, 多个CMD只执行最后一个.三种格式CMD [\"executable\", \"param1\", \"param2\"]  CMD [\"param1\", \"param2\"] CMD command param1 param2  \n  * EXPOSE 指定人哦更年期在运行时候，监听的端口\n  * EXTRYPOINT(只允许有一个) 给容器配置一个可以执行的命令, 每次使用镜像创建容器的时候，一个特定的应用程序被设置为默认的程序，该镜像在被调用时候，仅能运行指定的应用程序.\n  * WORKDIR RUN, CMD, ENTRYPOINT,等命令的工作目录.\n  * ENV \u003ckey\u003e \u003cvalue\u003e设置环境变量, 使用键值对, \n  * USER \u003cuid\u003e 镜像正在运行设置一个UID\n  * VOLUME 授权访问从容器内到主机上的目录  VOLUME ['/data']\n2. 写Dockerfile注意事项\n  * 保持常见的指令, MAINTAINER, 以及从上之下更新Dockerfile命令\n  * 构建镜像时，使用可以理解的标签\n  * 避免在Dockerfile中映射公有的端口\n  * CMD,ENTRYPOINT 使用数组语法\n\n## 小目标\n1. 打一个hadoop及其乱七八糟的的docker\n2. 打一个python dj docker\n3. Anubis docker\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xff-dev%2Fdocker-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xff-dev%2Fdocker-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xff-dev%2Fdocker-playground/lists"}