Comments (4)
We have been standardizing CMD for the default command for all official base images. It is easier to override (docker run -it nginx bash
vs docker run -it --entrypoint=/bin/bash nginx -i
). It can throw off a user if they say bash
and still get nginx running or just an error. We have been using entrypoint for start scripts that need access to possibly mounted volumes (see docker-library/postgres). We are still working to fully document the styles and guidelines of Official Images.
from nginx.
I thought it was accepted conventional wisdom to use ENTRYPOINT? In 99% of cases you'd want to just provide nginx switches as options to the run right? Using ENTRYPOINT you get:
# show configuration options
sudo docker run nginx:1.x -v
# send signalling to nginx:1.x
sudo docker run nginx:1.x -s reload
This feels very natural an mimics the signature of a bare-metal implementation. In comparison, the CMD approach requires the awkward double nginx reference:
# show configuration options
sudo docker run nginx:1.x nginx -v
# send signalling to nginx:1.x
sudo docker run nginx:1.x nginx -s reload
Furthermore, if the use cases you're looking to make easier are getting inside a running container then you'd still really need something like nsenter
/nsinit
wouldn't you? To get an interactive session with the nginx image then the --entrypoint
example makes sense but this is I think less common and if people find themselves needing to do this with their images then creating a simple Bash shortcut like:
function into () {
if [[ -z "$1" ]]; then
echo "Usage:"
echo " into [image-id]"
echo ""
echo "Current Images: [sudo docker images]"
echo ""
sudo docker images
else
echo "Jumping into Docker Image:"
echo " - sudo docker run -it --entrypoint=\"/bin/bash\" \"$1\""
sudo docker run -it --entrypoint="/bin/bash" "$1"
fi
}
Similarly I have done the same thing with jumping into running containers (which I find generally more useful):
function container () {
if [[ -z "$1" ]];then
echo "You must supply the container-id (or name)"
else
PID=`sudo docker inspect --format "{{ .State.Pid }}" $1`
echo "Process ID is "$PID
sudo nsenter --target "$PID" --mount --uts --ipc --net --pid
fi
}
from nginx.
So, in order to make it simpler for starting users, official images will not be using entrypoint
instead of cmd
. Refs: best practices#cmd, best practices#entrypoint.
Nginx upstream will now be providing and maintaining the images nginxinc/docker-nginx.
from nginx.
moved my rant to docker-library/official-images#692
from nginx.
Related Issues (10)
- Would you consider adding perl support? HOT 3
- Configuration folder & sites configuration as mountable volume HOT 7
- nginx doesn't use file for name resolution VS docker linking use file for name resolution HOT 1
- Remove this repo? HOT 4
- nginx runs directly as root HOT 11
- Build with packages? HOT 4
- nginx process not receiving SIGHUP HOT 5
- nginx serves corrupted files when files edited in host mounted volume HOT 4
- "WORKDIR /usr/local/nginx/html" assumes I have a /usr/local/nginx/html HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nginx.