码迷,mamicode.com
首页 > 其他好文 > 详细

Docker Tutorial

时间:2021-06-02 15:27:12      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:action   over   with   str   some   sign   can   dock   tor   

Docker Tutorial

Basic Docker Commands

pull an image

docker pull {image name}:{image version}

list all docker images

docker image ls -a

create and run a docker container

docker run     --name {container name}     -p {host port}:{container port}  	  -p {host ip}:{host port}:{container port}     -it     {image name}:{image version}     {command}

specificlly, we can assign network mode of the container, such as host mode

docker run --net=host

list all docker containers

docker container ls -a

start a container

docker start {container name}

verify is there containers are running

docker ps

run a command in a running container

docker exec     -it     {container name}     /bin/bash

stop a running containers

docker stop {container name}

remove a container

# docker rm [OPTIONS] CONTAINER
docker rm -f es

Docker in action

build and run an ElasticSearch image with official image

Pull an elasticsearch 7.12.1 image

docker pull elasticsearch:7.12.1

As running in development mode, create user defined network

docker network create somenetwork

Run Elasticsearch

docker run -d --name elasticsearch --net somenetwork -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.12.1

Test instrtction:

curl 127.0.0.1:9200

Docker Tutorial

标签:action   over   with   str   some   sign   can   dock   tor   

原文地址:https://www.cnblogs.com/fengyubo/p/14824795.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!