Previous article K8S – Tutorial – Building production level Linux systems

Empty your cup so that it can be filled again. —— Bruce Lee

This paper introduces

  • P2 Build a production-level Linux system
  • P3 Learn Docker in half an hour
  • P4 Write Dockerfile and upload DockerHub
  • P5 Docker SpringCloud – compose deployment
  • P6 Build Harbor private server for enterprise mirror
  • P7 K8S & Rancher is coming! Theory & Preparation
  • P8 Rancher2.3 built K8S 1.16 cluster
  • P9 Deploy Spring Cloud to Kubernetes
  • P10 Deploy Vue to Kubernetes config ingress
  • P11 Ha01-rke install Kubernetes cluster
  • P12 HA02-Helm deploys the Rancher cluster

This set of content

  1. Install the latest Dokcer
  2. mirror
  3. Port mapping
  4. Directory mount
  5. The log view
  6. Container operation
  7. Network related

Install the latest Dokcer

# Install Docker official source
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# update source
yum makecache fast
# installation
yum install -y docker-ce
Copy the code

解决 : yum install -y yum-utils

Then execute the installation of Docker official source

# Install Docker official source
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Copy the code

# update source
yum makecache fast
Copy the code

# installation
yum install docker-ce
Copy the code

# Set boot to boot
systemctl enable docker
# start
systemctl start docker
# check version
docker version
Copy the code

mirror

hub.docker.com

## 1. Download the imageDocker pull nginx: 1.17# Check local downloads
docker images
# delete mirrorDocker rmi nginx: 1.17## 2. Port operation
# run container
docker run --name test-nginx -d -p 8080:80 nginx
# Host network
docker run --rm network host --name test-naginx2 nginx

## 3. Mount
# run container
docker run --name test-nginx2 -d -p 8081:80 -v /data:/usr/share/nginx/html nginx
# enter
cd /data
# add file
vi index.html 
# Add content to wq

## 4. Log operations
docker logs -f test-nginx

docker logs -fThe container ID## 5. Enter the container and exit
# Enter container
docker exec -it test-nginx sh

# remove
docker rm test-nginx
Copy the code

If you cannot delete it, close it first and then delete it
docker stop test-nginx
docker rm -f test-nginx

View the container details
docker inspect test-nginx2

## 6. Network operation
View the container details
docker inspect test-nginx2

# Mirror busyBox tool
docker run -it --name test-nginx3 --link test-nginx busybox sh
Copy the code

# above
docker run -it --name test-nginx3 busybox sh
Copy the code

Form a complete set of data

Please pay attention to wechat (Java-note), message: K8S for supporting information

Write Dockerfile and upload DockerHub