In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to create an image and a container in Docker". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Create a mirror
1. Here is a handwritten Dockerfile document
2. Transfer the Dockerfile file to / usr/redis
3. Then you need to customize the network type
Since the default network cannot set a fixed address, we will create a custom network and specify the network segment: 172.10.0.01and16
Docker network create-subnet=172.10.0.0/16 mynetwork
Delete Custom Network
Docker network rm mynetwork is fine.
If you can't remember the command, then use docker network help directly.
4. Create an image
Docker build-t redis1.
Pay attention to a dot in the back.
5. View the created image
Docker images
Create a container
1. Create a container
Docker run-itd-- name redis-kaka-p 6384 name redis-kaka 6379-ip 127.10.0.4 redis1
Parameter explanation:
Redis-kaka: container name
Redis1: image name
-d: runs the container in the background and returns the container ID
-I: runs the container in interactive mode, usually in conjunction with-t
-p: Port mapping, format: host (host) port: container port
-t: reassign a pseudo-input terminal to the container, usually used in conjunction with-I
-- ip: make a fixed ip for the container
-- net: specifies the network mode
2. View the container
Docker ps-a\ docker container ls
3. Enter the container
Docker exec-it redis-kaka bash
That's all for "how to create an image and a container for Docker". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.