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

JavaScript implements front-end countdown effect

This article shares the specific code of JavaScri...

The simplest form implementation of Flexbox layout

Flexible layout (Flexbox) is becoming increasingl...

Centering the Form in HTML

I once encountered an assignment where I was give...

Detailed steps to change the default password when installing MySQL in Ubuntu

Step 1: Enter the directory: cd /etc/mysql, view ...

How to display and format json data on html page

JSON data is displayed and formatted on the HTML ...

Example of how to change the line spacing of HTML table

When using HTML tables, we sometimes need to chan...

In-depth exploration of whether Mysql fuzzy query is case-sensitive

Preface Recently, I have been busy writing a smal...

Summary of the differences between get and post requests in Vue

The operating environment of this tutorial: Windo...

How to import js configuration file on Vue server

Table of contents background accomplish Supplemen...

Windows Server 2008 R2 Multi-User Remote Desktop Connection Licensing

At work, we often need remote servers and often e...

How to build a private Docker repository using Harbor

Table of contents 1. Open source warehouse manage...

Mysql method to copy a column of data in one table to a column in another table

mysql copy one table column to another table Some...

HTML table tag tutorial (46): table footer tag

The <tfoot> tag is used to define the style...