How to add docker port and get dockerfile

How to add docker port and get dockerfile

Get the Dockerfile from the Docker image

docker history --format {{.CreatedBy}} --no-trunc=true $DockerImage
|sed “s//bin/sh\ -c\ #(nop)\ //g”|sed “s//bin/sh\ -c/RUN/g” |
tac

Note: This docker file does not map directories or ports and does not execute the docker startup script or server service.

Docker multiple port mapping

Docker multiple ports

docker run -it -d --name container-name -p p1:p1 -p p2:p2 new-image-name -ip xxxxx —restart=always

Method 1:

Adding ports at runtime

/var/lib/docker/containers/{container_id}/hostconfig.json

Method 2:
Submit a running container as an image:

docker commit containerid now/live

Run the image and add the port:

docker run -d -p 8000:80 now/live /bin/bash

Get the container IP:

docker inspect container_name | grep IPAddressiptable forwarding portiptables -t
nat -A DOCKER -p tcp --dport 8001 -j DNAT --to-destination
172.17.0.19:8000

Note: Mac may not be able to enter the screen

Passing files to Docker

sudo docker save -o /home/ubuntu_14804.tar 93123213127ccc

This is the end of this article about how to add ports to docker and get dockerfile. For more information about how to add ports to docker and get dockerfile, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to dynamically add ports to Docker without rebuilding the image
  • Add port mapping after docker container starts

<<:  Advantages and disadvantages of conditional comments in IE

>>:  mysql5.7 remote access settings

Recommend

How to deploy redis in linux environment and install it in docker

Installation Steps 1. Install Redis Download the ...

Server concurrency estimation formula and calculation method

Recently, I need to stress test the server again....

Implementing a simple timer in JavaScript

This article example shares the specific code of ...

Implementation of multiple instances of tomcat on a single machine

1. Introduction First of all, we need to answer a...

MySQL uses binlog logs to implement data recovery

MySQL binlog is a very important log in MySQL log...

Example code for using @media in CSS3 to achieve web page adaptation

Nowadays, the screen resolution of computer monit...

Which loop is the fastest in JavaScript?

Knowing which for loop or iterator is right for o...

How to turn a jar package into a docker container

How to turn a jar package into a docker container...

How to get the size of a Linux system directory using the du command

Anyone who has used the Linux system should know ...

How does the MySQL database implement the XA specification?

MySQL consistency log What happens to uncommitted...

Detailed graphic explanation of how to clear the keep-alive cache

Table of contents Opening scene Direct rendering ...

Nodejs module system source code analysis

Table of contents Overview CommonJS Specification...