# Docker 安装 Ubuntu

Ubuntu 是基于 Debian 的 Linux 操作系统。

### 1、查看可用的 Ubuntu 版本

访问 Ubuntu 镜像库地址： <https://hub.docker.com/_/ubuntu?tab=tags&page=1>。

可以通过 Sort by 查看其他版本的 Ubuntu。默认是最新版本 ubuntu:latest 。

![](/files/0I3oYtjWOeYskIQ3hoeq)

你也可以在下拉列表中找到其他你想要的版本：

![](/files/kurKKS8wurZv6gD2O8rx)

### 2、拉取最新版的 Ubuntu 镜像

```shell
docker pull ubuntu
```

或者：

```shell
docker pull ubuntu:latest
```

![](/files/NtoAmFzGM1gQYizwswRA)

### 3、查看本地镜像

```shell
docker images
```

![](/files/slNEOhiE9SVP4o6OCw2T)

在上图中可以看到我们已经安装了最新版本的 ubuntu。

### 4、运行容器，并且可以通过 exec 命令进入 ubuntu 容器

```shell
docker run -itd --name ubuntu-test ubuntu
$ docker exec -it ubuntu-test /bin/bash
```

![](/files/4JCTAzpmmvk3dcZxxbT5)

### 5、安装成功

最后我们可以通过 `docker ps` 命令查看容器的运行信息：

![](/files/gwpJVFtYOB7eCOK86gqC)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tuonioooo-notebook.gitbook.io/docker/install/docker-install-ubuntu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
