Install jdk, redis, python in docker container

1. Create a mirror
1. Install the centos7 system, first pull the mirror docker pull centos:centos7
2. Run the container docker run -itd --name centos-test --privileged centos:centos7 init
3. Enter the container through exec docker exec -it centos-test /bin/bash
2. jdk installation
1. Find out whether there is a jdk version in the system yum list java-1.8*
2. Install java1.8 and start yum install java-1.8.0-openjdk* -y
3. Verify whether it is installed Successful java -version
In addition, the method of yum install jdk has an advantage, the PATH path will be automatically configured. If not configured, you need to manually configure JAVA_HOME, JAR_HOME and other information in the profile. The configuration items are as follows:

JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el7_9.x86_64
JRE_HOME=$JAVA_HOME/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH

Just replace the jdk path in JAVA_HOME with the path you installed yourself.
Three, python installation
yum install python3

4. Redis installation
yum install wget
1. wget http://download.redis.io/releases/redis-5.0.7.tar.gz
2. Run and install gcc components yum -y install gcc automake autoconf libtool make
3. Unzip and install Package and install:
tar xzf redis-5.0.7.tar.gz
cd redis-5.0.7
make
make install

4. Modify the configuration file
Parameter value description
daemonize yes Make Redis run in daemon mode
bind 127.0.0.1 to 0.0.0.0
port port number Set the port number 6379 that Redis monitors
5. Copy the configuration file to /usr/local/bin
cp redis.conf /usr/local/bin/

5. Upload project files
docker cp local file absolute path container id: the absolute path to be placed in the container

Guess you like

Origin blog.csdn.net/GL666/article/details/129558319