Solve the problem of starting two ports that occupy different ports when docker run

Solve the problem of starting two ports that occupy different ports when docker run

Problem description:

After executing docker run -p 19918:19918/tcp -v /etc/localtime:/etc/localtime

Docker ps shows that port 19918 and another port are started, and no execution program is found in the registry.

Problem Analysis:

The other port started was configured before. It is speculated that the previous container was executed in addition to the project just built during run.

Solution:

View the containers in docker images and delete the same and two executed port containers. Execute again and it shows success!

Summarize:

Follow naming standards and remove unnecessary containers in a timely manner.

Additional knowledge: Run multiple different processes when docker is started, install ssh, and start running at the same time as jenkins when starting docker

Recently, when I was working on a Jenkins slave node, I needed to install ssh to establish a connection with the master. At this time, the slave needed to install the ssh service, but after the node was restarted, I had to manually start ssh.

To avoid trouble, run ssh and jenkins services when you want to start

1. When docker is running, starting ssh requires root privileges, otherwise you will not have permission to run many things on sshd

Therefore, when running docker, add a parameter --user root

docker run -d --user root --name jenkins_nodes3 --add-host gitlab.com:100.20.20.100 -v /home/_data_slave:/var/jenkins_home -p 8188:8080 -p 51005:50000 -p 8122:22 jenkins_ssh

2. Modify the /usr/local/bin/jenkins.sh startup file and add the following line

/usr/sbin/sshd -D > null 2>&1 &

If it is your own program, you can redirect the log to your own log file

The above article on solving the problem of starting two processes occupying different ports when running docker is all I have to share with you. I hope it can give you a reference, and I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Two ways to exit bash in docker container under Linux
  • Docker uses Supervisor to manage process operations
  • Enable sshd operation in docker

<<:  Object.entries usage you don't know in JavaScript

>>:  How to create a test database with tens of millions of test data in MySQL

Recommend

Detailed process analysis of docker deployment of snail cinema system

Environmental Statement Host OS: Cetnos7.9 Minimu...

TypeScript problem with iterating over object properties

Table of contents 1. Problem 2. Solution 1. Decla...

JS ES new features template string

Table of contents 1. What is a template string? 2...

Java example code to generate random characters

Sample code: import java.util.Random; import java...

vue-element-admin global loading waiting

Recent requirements: Global loading, all interfac...

Detailed explanation of MySQL clustered index and non-clustered index

1. Clustered Index Table data is stored in the or...

Detailed explanation of Angular parent-child component communication

Table of contents Overview 1. Overview of input a...

How to implement property hijacking with JavaScript defineProperty

Table of contents Preface Descriptors Detailed ex...

Let's talk about MySQL joint query in detail

Table of contents Union query 1. Query the ID and...

Two box models in web pages (W3C box model, IE box model)

There are two types of web page box models: 1: Sta...

HTML Nine-grid Layout Implementation Method

Diversifying website layouts is our front-end spe...

Embed player in web page embed element autostart false invalid

Recently, I encountered the need to embed a player...

How to use html table (to show the visual effect of web page)

We know that when using HTML on NetEase Blog, we ...