In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1 installation: yum install docker
2 start: systemctl start docker.service
After the installation is complete, use the following command to start the docker service and set it to boot:
[root@localhost ~] # service docker start
[root@localhost ~] # chkconfig docker on
(LCTT translation note: the old sysv syntax is used here, such as the new systemd syntax supported in CentOS 7, as follows:
[root@localhost ~] # systemctl start docker.service
[root@localhost ~] # systemctl enable docker.service
Exception:
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl-xe" for details.
3 View exception information: systemctl status docker.service
Content:
Modify:
Re-edit the docker configuration file:
Vi / etc/sysconfig/docker
Change to:
Restart: then systemctl start docker
Second, docker installs Tomcat container 2.1. Check the tomcat information of * device # docker search tomcat2.2 download the docker pull docker.io/tomcat with the highest Starts of the official image
2.3 View all mirrored docker images of docker
2.4 launch tomcatdocker run-p 8081 8080 docker.io/tomcat # if the port is occupied, you can specify the mapping port of the container and the host the former is the peripheral access port and the latter is the internal port of the container
2.5 access to http://192.168.195.156:8081/ after startup Note: (IP is the IP address of the virtual machine)
Deploy your own web reference docker ps # to view the running container using the following command
3.1. Upload your own war package to the host
3.2. Execute to check the address in the container comcat docker exec-it 3cb492a27475 / bin/bash # the middle one is the container id (CONTAINER_ID)
Throw the war packet to the host, throw it into the container, throw it into the tomcat/webapps.
There is no need to restart, docker will automatically deploy
3.4 one drawback of the above execution is that the project will no longer be available after the container is rebooted. Here is mode 2 to start docker run-d-v / home/docker.war: / usr/local/tomcat/webapps/docker.war-p 8080 usr/local/tomcat/webapps/docker.war-- name custom name docker.io/tomcat
3.5 the first two methods are recommended to be used in the test environment. After all, the code should be modified frequently. Mode 3 can be used in production. It is also recommended on the official website that FROM docker.io/tomcat # Image of your tomcat MAINTAINER XXX@qq.com # author COPY docker.war / usr/local/tomcat/webapps # be placed in tomcat's webapps directory
3.8.1 generate a new image: docker build-t nginx-demo:v1.
3.8.2 launch a new mirror docker run-p 8081 8080 nginx-demo:v1
four. Export Mirror
4.1 View existing mirrors
4.2 Export
Docker save # ID/#name > / home/nginx-demotest.tar
Here are some commands that are commonly used in working with docker containers:
# View all docker images# running Container docker ps# View docker Container docker ps-a # start tomcat:7 Image docker run-p 8080 docker ps 8080 tomcat:7# launch docker run-d tomcat:7# stop a container docker stop b840db1d182b# enter a container docker attach d48b21a7e439# enter a running container and interact with docker exec-it e9410ee182bd / bin/sh# with command line Run docker run-I-t-p 8081 bin/bash 8080 tomcat:7 / bin/bash interactively
Reference: installation: https://blog.csdn.net/qq_32351227/article/details/78673591
Https://blog.csdn.net/leoe_/article/details/70225646
Create a docker image using Dockerfile
Https://blog.csdn.net/rznice/article/details/52211620
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.