-
Notifications
You must be signed in to change notification settings - Fork 0
Docker
https://blog.tomy168.com/2019/08/centos-76-kubernetes.html
[root@server ~]# yum install wget net-tools nano -y
[root@server ~]# hostnamectl set-hostname XXXXXX
[root@server ~]# nano /etc/hosts
[root@server ~]# setenforce 0
[root@server ~]# sed -i 's@SELINUX=enforcing@SELINUX=disabled@' /etc/sysconfig/selinux
[root@server ~]# swap -a
[root@server ~]# nano /etc/fstab
[root@server ~]# systemctl disable firewalld && systemctl stop firewalld
[root@server ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
[root@server ~]# echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
[root@server ~]# echo "net.bridge.bridge-nf-call-iptables = 1" >> /etc/sysctl.conf
[root@server ~]# modprobe br_netfilter
[root@server ~]# echo "br_netfilter" > /etc/modules-load.d/br_netfilter.conf
[root@server ~]# sysctl -p
[root@server ~]# lsmod | grep br_netfilter
[root@server ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@server ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
[root@server ~]# nano /etc/yum.repos.d/kubernetes.repo
[root@server ~]# yum clean all && yum repolist
[root@server ~]# yum install docker-ce-18.09.8 --nogpgcheck
[root@server ~]# systemctl enable docker && systemctl start docker
[root@server ~]# yum install kubelet-1.15.2 kubectl-1.15.2 kubeadm-1.15.2 --nogpgcheck --disableexcludes=kubernetes
[root@server ~]# systemctl enable kubelet.service
docker run -it ubuntu
docker run -itd ubuntu
docker attach <id>
docker ps
docker exec -it <id> bash
docker-machine create –driver=virtualbox machine1
docker-machine ls
docker-machine ssh machine1
inside machine1 run: docker run hello-world
docker run --memory 512MB --name nginx3 -d nginx
setting cpu-quota to 25000 limits a container to 25% of CPU resource
combine with cpu-period, such as cpu-period = 100ms and cpu=quota = 200ms ~ at most use 2 cpu
1000000 (1 second) cpu-quota = 200000 => within 1 second, to use 0.2 cpu
docker run --cpu-period=1000000 --cpu-quota=500000 --name cputest2 -it cento
// find container
docker ps
// find container ip address
docker inspect container_name | grep IPAddress
// use iptables to map local port to container port, such as 7101
iptables -t nat -A DOCKER -p tcp --dport 7101 -j DNAT --to-destination 172.17.0.3:7101
[origin@master jenkins-data]$ cat docker-compose.yml
version: '3'
services:
jenkins:
container_name: jenkins
image: jenkins/jenkins
ports:
- 8080:8080
volumes:
- $PWD/jenkins_home:/var/jenkins_home
networks:
- net
remote_host:
container_name: remote-host
image: remote-host
volumes:
- $PWD/aws-s3.sh:/tmp/script.sh
build:
context: centos7
networks:
- net
db_host:
container_name: db
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=abcd1234
volumes:
- $PWD/db_data:/var/lib/mysql
networks:
- net
networks:
net:
$ ssh-keygen -f remote_key
[origin@master centos7]$ cat Dockerfile
FROM centos
RUN yum -y install openssh-server
RUN yum -y install openssh-clients
RUN useradd remote_user && \
echo "1234" | passwd remote_user --stdin && \
mkdir /home/remote_user/.ssh && \
chmod 700 /home/remote_user/.ssh
COPY remote-key.pub /home/remote_user/.ssh/authorized_keys
RUN chown remote_user:remote_user -R /home/remote_user/.ssh/ && \
chmod 600 /home/remote_user/.ssh/authorized_keys
RUN /usr/sbin/sshd-keygen
RUN yum -y install mysql
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
pip install awscli --upgrade
CMD /usr/sbin/sshd -D
$ ssh -i remote_key -o "StrictHostKeyChecking no" user@hostRUN executes command(s) in a new layer and creates a new image. E.g., it is often used for installing software packages.
CMD sets default command and/or parameters, which can be overwritten from command line when docker container runs.
ENTRYPOINT configures a container that will run as an executable. <- cannot be ignore
Entry Point vs CMD
https://goinbigdata.com/docker-run-vs-cmd-vs-entrypoint/
Configure Docker project for different environments using Docker Compose 3
Run Different Environments
Spring Boot + Build Docker Image
http://www.ityouknow.com/springboot/2018/03/19/spring-boot-docker.html
Spring Boot + Build Docker Image Sample Project
https://github.com/carnellj/spmia-chapter1
MSSQL on docker
https://dotblogs.com.tw/swater111/2017/01/16/183653
Docker Introduction
https://philipzheng.gitbooks.io/docker_practice/content/data_management/volume.html
Docker學習筆記
https://peihsinsu.gitbooks.io/docker-note-book/docker-save-image.html
Get Docker for Windows
https://store.docker.com/editions/community/docker-ce-desktop-windows
Introduction and Tutorials
https://github.com/twtrubiks/docker-tutorial
Docker Command
http://www.runoob.com/docker/docker-exec-command.html
Docker Jenkins example
https://oomusou.io/docker/jenkins/
Install Java 8
https://www.atlassian.com/blog/software-teams/deploy-java-apps-with-docker-awesome
Install Docker in Linux (Bash Command Line History) for Redhat 7.5
348 yum install docker
349 docker
350 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
351 yum install docker-ce
352 yum install docker
353 sudo yum remove docker docker-common docker-selinux docker-engine-selinux docker-engine docker-ce
355 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
356 sudo yum install docker-ce
359 sudo yum -y install docker-ce
360 sudo yum erase docker-engine-selinux
361 yum install -y --setopt=obsoletes=0 docker-ce-18.03.1.ce-1.el7.centos docker-ce-selinux-18.03.1.ce-1.el7.centos
362 yum install docker-ce-selinux-17.03.1.ce-1.el7.centos
363 yum install docker-ce-selinux-18.03.1.ce-1.el7.centos
364 yum install -y --setopt=obsoletes=0 docker-ce-17.03.1.ce-1.el7.centos docker-ce-selinux-17.03.1.ce-1.el7.centos
365 docker
367 docker run hello-world
368 service docker start
369 docker run hello-world
371 docker run hello-world
- freemarker
- thymeleaf
- JMX (jconsole)
- ZeroMQ
- microk8s
- multipass
- pwsh (powershell)