# 应用部署=初级

## MySQL部署&#x20;

（1）拉取mysql镜像

```
docker pull centos/mysql-57-centos7
```

（2）创建容器

```
docker run -di --name=tensquare_mysql -p 33306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql
```

-p 代表端口映射，格式为 宿主机映射端口:容器运行端口&#x20;

-e 代表添加环境变量 MYSQL\_ROOT\_PASSWORD 是root用户的登陆密码&#x20;

（3）远程登录mysql&#x20;

连接宿主机的IP ,指定端口为33306

## tomcat部署

（1）拉取镜像

```
docker pull tomcat:7-jre7
```

（2）创建容器&#x20;

创建容器 -p表示地址映射

```
docker run -di --name=mytomcat -p 9000:8080
-v /usr/local/webapps:/usr/local/tomcat/webapps tomcat:7-jre7
```

## Nginx部署

（1）拉取镜像

```
docker pull nginx 
```

（2）创建Nginx容器

```
docker run -di --name=mynginx -p 80:80 nginx
```

## Redis部署&#x20;

（1）拉取镜像

```
docker pull redis
```

&#x20;（2）创建容器

```
docker run -di --name=myredis -p 6379:6379 redis
```


---

# 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://docker.shujuwajue.com/docker-de-shi-yong/docker-jing-xiang-guan-li.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.
