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

mysql 5.7.19 latest binary installation

First download the zip archive version from the o...

Native JS to achieve cool paging effect

This article uses an example to share with you a ...

How to install and use Ubuntu Docker

Table of contents 1. Automatic installation using...

How to view and clean up Docker container logs (tested and effective)

1. Problem The docker container logs caused the h...

HTML Tutorial: Collection of commonly used HTML tags (6)

These introduced HTML tags do not necessarily ful...

Modify the boot time of grub in ubuntu

The online search to modify the grub startup time...

Vue implements the product tab of the product details page function

This article example shares the specific code of ...

Vue element implements table adding, deleting and modifying data

This article shares the specific code of vue elem...

WeChat Mini Program Lottery Number Generator

This article shares the specific code of the WeCh...

JS ES new features: Introduction to extension operators

1. Spread Operator The spread operator is three d...

Using JS to determine the existence of elements in an array in ten minutes

Preface In front-end development, you often need ...

Explain MySQL's binlog log and how to use binlog log to recover data

As we all know, binlog logs are very important fo...