Docker engine

本文详细介绍了Docker容器技术的基本概念、结构及常用命令。Docker提供了一种方式来安全地运行应用程序,这些应用程序被封装在容器中并带有所有依赖项和库。与虚拟机不同,容器不需要捆绑整个操作系统,只需包含使软件正常工作的所需库和设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Docker(Docker Engine)
• Define

1. Docker provides a way to run applications securely isolated in a container, packaged with all its dependencies and libraries.
2. Containers are a way to package software in a format that can run isolated on a shared operating system. Unlike VMs, containers do not bundle a full operating system - only libraries and settings required to make the software work are needed

• Structure
这里写图片描述
the client-server application made up of the Docker daemon, a REST API that specifies interfaces for interacting with the daemon,and a command line interface (CLI) client that talks to the daemon (through the REST API wrapper).

• CLI
https://docs.docker.com/engine/reference/run/
○ Sample

    § docker --help
    § docker build -t songgs/apache-php-mysql:20m .
    § docker run -d -p 8080:80 -u 0:0 --name wplocal -v /var/LWASFiles/Sites/new2/home:/home -e PORT="80"    appsvc/apps:wordpress
    § docker exec -it containerid bash
    § docker push songgs/apache-php-mysql:20m
    § docker rmi –f $(docker images -q -f dangling=true) 
    § docker rm -f $(docker ps -aq -f status=exited)

• Learn : 中文版

Docker Image

  1. Apache-PHP-MySQL
    PHP installed as apache module: http://php.net/manual/en/security.apache.php
  2. Nginx-PHP
  3. Python
    nginx <-> /tmp/uwsgi.sock <-> uWSGI <-> Python app <-> Psycopg2 <-> remote PostgreSQL database
### Docker Engine 安装配置 #### WSL2 中安装 Docker Engine 方法概述 在 WSL2 中安装 Docker 主要有两种常见的方式:一种是利用 Docker Desktop for Windows 并配置 WSL2 作为后端;另一种是在 WSL2 内直接部署 Docker Engine[^1]。 对于希望深入理解 Linux 环境下容器操作或是寻求更轻量级方案的用户来说,在 WSL2 下单独安装 Docker Engine 成为了理想的选择。这种方式不仅减少了资源占用,还提供了更加贴近生产环境的学习平台。 #### Docker Engine 版本需求 确保所使用的 Docker-ce 至少为版本 `18.03.0-ce` 或更高版本,并且如果计划使用 Docker Compose,则需保证其版本不低于 `1.28.5`[^3]。 #### 配置镜像加速器 针对中国大陆地区的开发者而言,由于网络原因可能导致拉取官方仓库中的镜像速度较慢甚至失败的情况发生。此时可以通过修改 Docker 的配置文件来指定国内可用的镜像源地址。具体做法如下: - 对于 Windows 用户,可通过 Docker Desktop 图形界面进行设置: - 打开 Docker Desktop 应用程序; - 导航至 **Settings (设置)** -> **Docker Engine** 页面; - 向 JSON 文件内添加 `"registry-mirrors"` 参数以指向合适的镜像站; - 修改完成后点击保存按钮使更改生效[^4]。 ```json { "registry-mirrors": ["https://<your_mirror>.mirror.aliyuncs.com"] } ``` > 注意替换 `<your_mirror>` 为你实际选用的服务提供商名称。 #### 常见问题及其解决方案 ##### 使用已弃用接口遇到困难 当尝试调用某些旧版 API 接口时可能会收到提示告知这些功能已经被移除不再维护的消息。这是因为随着技术进步和发展,部分早期设计的功能逐渐被淘汰并停止服务支持。面对这种情况建议查阅最新文档寻找替代方案或升级到新版本API[^2]。 ##### 关于 pool/ 目录的作用说明 有时会看到有关 `/var/lib/docker/pool/` 路径的信息,但实际上这并不是指代某个具体的 Docker 发布版本,而是用来存储所有 .deb 类型软件包的一个集合位置。一般情况下无需手动访问该路径下的内容除非有特殊调试需求[^5]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值