Cloud server configuration docker java mysql mongodb redis environment

Disk Mount

-l the fdisk # See the list of disks 
mkfs.ext4 / dev / VDB # formatted disk  Mount / dev / VDB / Data # mount disk / Data echo '/ dev / VDB / Data ext4 Defaults, nofail 0. 1 ' >> / etc / fstab # start the server automatically mount -a Mount # df -h check script to automatically mount the disk mounting information see #

Installation docker

Update yum # update package system 
yum the install yum-utils -Y-persistent-Device-Mapper Data LVM2 #-mounted utils yum  yum-config-Manager---add the repo https://download.docker.com/linux/centos/ ce.repo-docker # yum source for the warehouse location Add docker docker-ce install yum # installation systemctl start docker docker # start docker

Java mirrored pull

docker pull java:8

Mirrored pull MySql

pull MySQL Docker # pull MySql 
Docker RUN -p 3306: 3306 --name MySQL \ # RUN run container -p port 3306 is mapped to the host 3306 container port container operation --name name  --restart Always = \ # hang up automatically restarts -v / etc / localtime: / etc / localtime \ # host to the local time in a clip to hang the container -v / Data / MySQL / log: / var / log / MySQL \ # log folder mount to host -v / data / MySQL / data: / var / lib / MySQL \ # mount the data folder to a host -v / data / MySQL / MySQL-files: / var / lib / MySQL-files \ # data folder to the host to mount -v / the Data / MySQL / conf: / etc / MySQL \ # configure folders hanging on to the host MYSQL_ROOT_PASSWORD = xiuingmysql -e. \ # initialize the MySQL root password -d # -d background

Mirrored pull Mongodb

pull mongo Docker # pull MongoDB 
Docker RUN -p 27017: 27017 --name mongo \ name -p # run run container port container to map 27017 to 27017 host --name container port operation  --restart Always = \ # hang up automatically restarts -v / etc / localtime: / etc / localtime \ # host to the local time in a clip to hang the container -v / data / MongoDB: / var / lib / MongoDB \ # mount the data folder to a host mongo -d # running in the background

Mirrored pull Redis

RUN -p 6379 Docker: 6379 --name Redis \ # RUN run to map the container vessel -p port 6379 to host the 6379 running of the container port --name name 
--restart = Always \ # hang up automatically restart -v / etc / localtime: / etc / localtime \ # host to the local time in a clip to hang the container -v / data / Redis: / data / Redis \ # mount the data folder Redis host -d \ # -d background --requirepass "123456 " # password 123456

docker commonly used commands

Start Docker systemctl # start Docker 
systemctl STOP Docker # stop the container  Docker ImagesRF Royalty Free # listed rmi --name mirror Docker # PS remove the mirror Docker # -a lists all container STOP --name Docker # Stop Start --name container Docker # start RM --name container Docker # delete container stats -a Docker # View all containers System df cases Docker # view disk usage Docker Docker Exec -it --name / bin / bash # bash into the interior of the container Docker

Guess you like

Origin www.cnblogs.com/burningmyself/p/12073641.html