标签:ext4 doc git ted format uid 说明 tps x86
docker-ce.x86_64 # 社区版
docker-ee # 企业版
docker镜像站:https://hub.docker.com/
Kubernetes:https://kubernetes.io/zh/
阿里云镜像站:https://developer.aliyun.com/special/mirrors/notice
#:docker version
Client:
Version: 19.03.8
API version: 1.40
Go version: go1.13.8
Git commit: afacb8b7f0
Built: Fri Dec 18 12:15:19 2020
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.13.8
Git commit: afacb8b7f0
Built: Fri Dec 4 23:02:49 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.3.3-0ubuntu2.2
GitCommit:
runc:
Version: spec: 1.0.1-dev
GitCommit:
docker-init:
Version: 0.18.0
GitCommit:
#: hostnamectl set-hostname worker
#: sysctl -a | grep forward
***
net.ipv4.ip_forward = 1
***
#: vim /etc/sysconfig/selinux 或者 setenforce 0
SELINUX=permissive
swapoff /swap.img
注释/etc/fstab
root@k8s:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use ‘blkid‘ to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/ubuntu-vg/ubuntu-lv during curtin installation
/dev/disk/by-id/dm-uuid-LVM-EbCUAM6ESxObgKwpg7QLLPDJCF82GAj2oYMBzo5mS8PFCe3jnENIvqjzUPGGMGIX / ext4 defaults 0 0
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/ba31387b-7c3e-46eb-bdf0-192cdd38f590 /boot ext4 defaults 0 0
#/swap.img none swap sw 0 0
systemctl stop firewalld
#: wget https://download.docker.com/linux/centos/docker-ce.repo -O /etc/yum.repo.d
#: yum repolist
#: yum -y install docker-ce docker-ce-cli containerd.io
#: systemctl start docker
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-‘EOF‘
{
"registry-mirrors": ["https://0rj343vq.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
docker search nginx
docker pull nginx:latest
root@node1:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 a70d36bc331a 7 weeks ago 449MB
busybox latest b97242f89c8a 7 weeks ago 1.23MB
nginx latest f6d0b4767a6c 8 weeks ago 133MB
metallb/speaker main 252ca41551e9 2 months ago 84.3MB
metallb/controller main 3a44dd1ab374 2 months ago 75.3MB
centos latest 300e315adb2f 3 months ago 209MB
docker run -dit --name=nginx web1
docker ps -a
docker ps -a | grep Exited | awk ‘{print $1}‘
docker ps -a | grep Exited | awk ‘{print $1} > /tmp/stop-c
while read c; do docker rm $c; done < /tmp/stop-c
docker save docker.io/nginx > nginx.tar
docker load -i nginx.tar
查看详细命令:docker history --no-trunc docker.io/nginx
root@node1:~# docker history nginx
IMAGE CREATED CREATED BY SIZE COMMENT
f6d0b4767a6c 8 weeks ago /bin/sh -c #(nop) CMD ["nginx" "-g" "daemon… 0B
<missing> 8 weeks ago /bin/sh -c #(nop) STOPSIGNAL SIGQUIT 0B
<missing> 8 weeks ago /bin/sh -c #(nop) EXPOSE 80 0B
<missing> 8 weeks ago /bin/sh -c #(nop) ENTRYPOINT ["/docker-entr… 0B
<missing> 8 weeks ago /bin/sh -c #(nop) COPY file:0fd5fca330dcd6a7… 1.04kB
<missing> 8 weeks ago /bin/sh -c #(nop) COPY file:0b866ff3fc1ef5b0… 1.96kB
<missing> 8 weeks ago /bin/sh -c #(nop) COPY file:e7e183879c35719c… 1.2kB
<missing> 8 weeks ago /bin/sh -c set -x && addgroup --system -… 63.7MB
<missing> 8 weeks ago /bin/sh -c #(nop) ENV PKG_RELEASE=1~buster 0B
<missing> 8 weeks ago /bin/sh -c #(nop) ENV NJS_VERSION=0.5.0 0B
<missing> 8 weeks ago /bin/sh -c #(nop) ENV NGINX_VERSION=1.19.6 0B
<missing> 8 weeks ago /bin/sh -c #(nop) LABEL maintainer=NGINX Do… 0B
<missing> 8 weeks ago /bin/sh -c #(nop) CMD ["bash"] 0B
<missing> 8 weeks ago /bin/sh -c #(nop) ADD file:422aca8901ae3d869… 69.2MB
root@node1:~#
root@node1:~# docker run -dit --restart=always --name=c1 centos:latest
314ffbcdfa193f38d73dffa026dd816a917dad0d3367916ea5a71fba593d6beb
root@node1:~#
# 启停容器
docker stop/start c1
# 删除容器
docker rm c1 -f
# 访问容器
attach: 容器中要有bash/sh
docker attach c1
# 容器中运行命令
docker exec c1 /bin/bash -c "cat /etc/redhat-release"
docker exec c1 /bin/bash -c "yum install net-tools -y"
docker commit c1 my-centos
docker run -dit --restart=always -e MYSQL_ROOT_PASSWORD=redhat --name=my-db mysql:5.7
Mysql数据库使用前参考使用说明:https://hub.docker.com/_/mysql
* 查看容器中环境变量
root@node1:~# docker run -dit --restart=always -e MYSQL_ROOT_PASSWORD=redhat --name=my-db mysql:5.7
0d96ee5757c8323732daf153d0d7b2d7d1d1b0c0e18d22ccab9c23c40600aead
root@node1:~# docker exec -it my-db bash
root@0d96ee5757c8:/# env
MYSQL_MAJOR=5.7
HOSTNAME=0d96ee5757c8
PWD=/
MYSQL_ROOT_PASSWORD=redhat
HOME=/root
MYSQL_VERSION=5.7.33-1debian10
GOSU_VERSION=1.12
TERM=xterm
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env
root@0d96ee5757c8:/#
* 查看容器详细信息
docker inspect my-db
docker run -dit --restart=always --name=my-db2 -e MYSQL_ROOT_PASSWORD=redhat -v /mysql:/var/lib/mysql mysql:5.7
root@node1:~# docker network list
NETWORK ID NAME DRIVER SCOPE
a390d4dd97e4 bridge bridge local
7ecb1cba6445 host host local
5c842fd3da29 none null local
root@node1:~# dokcer network inspect a390d4dd97e4
man 1 docker-network-create
docker network create --driver=bridge --subnet=10.0.0.0/24 network1
* 指定network1创建容器
docker run -dit --restart=always --name=c2 --network=network1 centos:7
在docker服务器上使用容器IP可以访问到容器服务器,对于生产网络不可见
docker run -dit --restart=always --name=web1 -p 80:80 --network=network1 nginx
docker pull wordpress
docker pull mysql:5.7
#: docker run -dit --restart=always --name=mysql -e MYSQL_ROOT_PASSWORD=redhat -e MYSQL_USER=wordpress -e MYSQL_PASSWORD=wordpress -e MYSQL_DATABASE=wordpress mysql:5.7
#: docker run -dit --restart=always --name=wordpress -e WORDPRESS_DB_HOST=x.x.x.x -e WORDPRESS_DB_USER=wordpress -e WORDPRESS_DB_PASSWORD=wordpress -e WORDPRESS_DB_NAME=wordpress -p 80:80 wordpress
* 或者
#: docker run -dit --restart=always --name=mysql -e MYSQL_ROOT_PASSWORD=redhat -e MYSQL_USER=wordpress -e MYSQL_PASSWORD=wordpress -e MYSQL_DATABASE=wordpress -v /wp-mysql:/var/lib/mysql mysql:5.7
#: docker run -dit --restart=always --name=wordpress --link mysql:db -e WORDPRESS_DB_HOST=db -e WORDPRESS_DB_USER=wordpress -e WORDPRESS_DB_PASSWORD=wordpress -e WORDPRESS_DB_NAME=wordpress -v /wpdata:/var/www/html -p 80:80 wordpress
To be continue!
标签:ext4 doc git ted format uid 说明 tps x86
原文地址:https://www.cnblogs.com/bigdad/p/14506872.html