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 explanation of commands to view linux files

How to view linux files Command to view file cont...

How to extract string elements from non-fixed positions in MySQL

Preface Note: The test database version is MySQL ...

Modify file permissions (ownership) under Linux

Linux and Unix are multi-user operating systems, ...

Table td picture horizontally and vertically centered code

Html code: Copy code The code is as follows: <t...

MySQL green version setting code and 1067 error details

MySQL green version setting code, and 1067 error ...

Detailed tutorial on using VMware WorkStation with Docker for Windows

Table of contents 1. Introduction 2. Install Dock...

Centos builds chrony time synchronization server process diagram

My environment: 3 centos7.5 1804 master 192.168.1...

What is Nginx load balancing and how to configure it

What is Load Balancing Load balancing is mainly a...

Native JS to implement the aircraft war game

This article example shares the specific code of ...

Detailed explanation of the use of Linux lseek function

Note: If there are any errors in the article, ple...

Implementation of the Pycharm installation tutorial on Ubuntu 18.04

Method 1: Download Pycharm and install Download a...

A simple method to be compatible with IE6's min-width and min-height

If a website is widescreen, you drag the browser ...

MySQL database import and export data error solution example explanation

Exporting Data Report an error SHOW VARIABLES LIK...