docker run --name my-zookeeper -p 2181:2181 -d zookeeper 中的 -d 啥意思
时间: 2024-01-14 13:03:53 浏览: 147
`-d` 是 Docker 运行容器时的一个参数,表示在后台(detached mode)运行容器,使得容器可以在后台运行而不影响当前命令行的使用。在运行 `docker run` 命令时加上 `-d` 参数,则容器会在后台运行并输出容器 ID。在上述命令中,`-d` 表示后台运行 zookeeper 容器,并将容器 ID 输出到命令行。
相关问题
docker run -it --name zookeeper -p 12181:2181 -d wurstmeister/zookeeper:latest 根据这条命令帮我写个docker-compose
Sure! Here's the equivalent `docker-compose.yml` file for the given Docker command:
```yaml
version: '3'
services:
zookeeper:
image: wurstmeister/zookeeper:latest
ports:
- 12181:2181
container_name: zookeeper
tty: true
restart: always
```
You can save this content into a file named `docker-compose.yml` and run `docker-compose up -d` to start the ZooKeeper container.
docker run -it --name kafka01 -p 19092:9092 -d -e KAFKA_BROKER_ID=0 -e KAFKA_ZOOKEEPER_CONNECT=192.168.233.129:12181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://192.168.233.129:19092 -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 wurstmeister/kafka:latest 根据这条命令帮我写个docker-compose
Certainly! Here's the equivalent `docker-compose.yml` file for the given Docker command:
```yaml
version: '3'
services:
kafka01:
image: wurstmeister/kafka:latest
ports:
- 19092:9092
environment:
- KAFKA_BROKER_ID=0
- KAFKA_ZOOKEEPER_CONNECT=192.168.233.129:12181
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://192.168.233.129:19092
- KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092
container_name: kafka01
tty: true
restart: always
```
You can save this content into a file named `docker-compose.yml` and run `docker-compose up -d` to start the Kafka container.
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)