Issue with ENTRYPOINT of [some] official docker images? [closed] - docker

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 days ago.
The community reviewed whether to reopen this question 4 days ago and left it closed:
Original close reason(s) were not resolved
Improve this question
https://github.com/nginxinc/docker-nginx/pull/752
The "issue":
If you create Dockerfile FROM nginx and specify a custom CMD (not starting with nginx), then default scripts, like environment variables substitution in config files, will not be executed at container startup. I find this behavior confusing, and looks like it is not just for me: https://github.com/nginxinc/docker-nginx/issues/422 .
The mainteiner of nginx image answered with links to other official Dockerfiles:
https://github.com/docker-library/postgres/blob/master/docker-entrypoint.sh#L302
https://github.com/docker-library/cassandra/blob/master/docker-entrypoint.sh#L43
https://github.com/docker-library/mongo/blob/master/docker-entrypoint.sh#L245
https://github.com/apache/couchdb-docker/blob/main/3.3.1/docker-entrypoint.sh#L27
https://github.com/Kong/docker-kong/blob/master/docker-entrypoint.sh#L31
https://github.com/MariaDB/mariadb-docker/blob/master/docker-entrypoint.sh#L486
https://github.com/docker-library/mysql/blob/master/template/docker-entrypoint.sh#L386
So i wonder is there any reason why is entrypoint scripts of these images implemented this way? That if you override CMD(with custom script for example not named as nginx or mysql, etc..) then ENTRYPOINT is not doing anything other than exec your CMD. So it is equivalent of implicitly overriding the ENTRYPOINT without explicitly overriding it.
Isn't it will be more clear that if you specify custom CMD then you get all default ENTRYPOINT behavior, and if you don't need it then you override the ENTRYPOINT explicitly?

Related

How to add - to environment variables in git bash [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 29 days ago.
Improve this question
I tried to set the following environment variables so that I could quickly start the docker container
export doup=docker-compose up -d
However, the following error occurred and it could not be set up.
bash: export: `-d': not a valid identifier
Is there a way to set - to an environment variable?
You'd need to quote it:
export doup='docker-compose up -d'
but what you probably actually want is an alias:
alias doup='docker-compose up -d'

Dockerizing - JAVA EAR [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I was assigned to work with ten year old legacy Java project which generates the following artifacts.
xxx.jar
xxx.jar
xxx.jar
xxx.war
I am asked to dockerize the application and deploy it into Kubernetes. So, I am planning to build the EAR artifact using the below structure
lib
META-INF
MANIFEST.MF
application.xml
xxx.jar
xxx.jar
xxx.jar
xxx.war
My dockerfile would be something like this
FROM tibco/bwce:latest
MAINTAINER Tibco
ADD bwce-rest-bookstore-app.ear /EXPOSE 8080
docker build -t bwce-rest-bookstore-app.
am I in the right direction?
You are going in the right direction, however few things are wrong with your Dockerfile:
MAINTAINER instruction is depracted. Use LABEL instead.
ADD instruction require two arguments - source and destination. Assuimg your workdir is /:
ADD bwce-rest-bookstore-app.ear /
EXPOSE instruction must be on it's own line.
I'm not sure how EAR artifacts work, but you probably need to start your application after container is created. This can be done with CMD instruction. For example:
CMD ["/apth/to/executable","param1","param2"]
Taking all of the above into consideration your Dockerfile should look more or less like this:
FROM tibco/bwce:latest
LABEL maintainer="Tibco" #replace MAINTAINER with LABEL
ADD bwce-rest-bookstore-app.ear / #add EAR to root workdir
EXPOSE 8080
CMD ["/apth/to/executable","param1","param2"]
I strongly recommend going through Dockerfile reference.
I don't know the EAR artifact and Java, but as per Docker Docs, the ADD command can extract .tar.gz files but not .ear file format, so I think it's better to have a Dockerfile like this (see here for extract):
FROM tibco/bwce:latest
MAINTAINER Tibco # you can remove this line
ADD bwce-rest-bookstore-app.ear
RUN jar xf bwce-rest-bookstore-app.ear
EXPOSE 8080

Alternative to running multiple commands to configure application [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
When I develop my applications I have lots of things going on. They're usually micro services and each has their own build tools. For example I have to run a build script for hugo, and a build script for webpack, and some gulp tasks. I'll also have to generate some files, keys etc.
It's a huge pain to have to run these manually. When I test in dev, and staging I'm constantly rebuilding the docker containers running the same commands. It gets painful.
Are there any tools that can help with this? Where I can run one command and have it rebuild everything in my application? A bash script would work but that's not an option.
I've seen people use build scripts like in C, but I can't find anything similar for devops. Maybe docker has a tool for this?
You probably want to build your containers rather than use an image.
I'll assume you're using docker-compose or docker stack deploy to start you containers. In both scenarios, you have a .yaml file that describes your services. Let's assume that the following is part of your config right now, to deploy a service in which you'll want to run a build script for webpack, and that you're using a Node.js image as your base (and you can adapt that to your actual scenario easily):
# ...
services:
webpack:
image: node:8.12.0
# ...
# ...
Instead of using the image directly, you can specify a build context:
# ...
services:
webpack:
build:
context: ./docker/webpack
# ...
# ...
# ...
Create a directory structure accordingly so that there's a docker/webpack folder. Inside that folder, create a build-script.sh shell script with the commands you want to run, and create a Dockerfile file. This file should look like:
FROM node:8.12.0
COPY build-script.sh /tmp/build-script.sh
RUN npm install --save-dev webpack \
&& /bin/sh /tmp/build-script.sh
Then when you run docker-compose up or docker stack deploy ..., it will build a container already initialized with the content of the build-script.sh script. Obviously there is much more you can do with this Dockerfile, but for your use-case, you can start with something pretty simple. You can even avoid creating the script altogether and run all of your commands in a single huge RUN statement (using \ at the end of each line except the last one, and separating different commands with &&).
Later on, you could even build an image yourself by uploading this Dockerfile to github, and making an account on hub.docker.com and linking it to your github. You could call it something like BugHunterUK-dev-environment or something and use image: BugHunterUK-dev-environment:latest in your Yaml file.

Is there a startup file (like .bashrc) for i3 where i can set environmet variables? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
It would help me to setup my system-wide proxy. I'm using latest Ubuntu and tried /etc/X11/xinit/xinitrc ~/.xinitrc and ~/.xsession,
export HTTP_PROXY=http://....
But that did not work.
Apparently i3 uses sh to launch stuff, and does not source $PATH from ~/.bashrc :
cat ~/.xsession-errors
(...)
/bin/sh: 1: mycommand: not found
So, just create a ~/.xsessionrc file and put your statements in it :
export HTTP_PROXY=http://....
Then logout and back in ; It should work now.
System-wide environment can be setup by placing a script in /etc/profile.d/
For example, you may create /etc/profile.d/proxy with your
export HTTP_PROXY=http:// # enter your proxy settings here
Then chmod +x this file, then reboot :
chmod +x /etc/profile.d/proxy
systemctl reboot
After reopening your session you could check the variables are there :
env | grep HTTP
You should see the variables set with the values you entered in the profile script.
In order to set system wide proxy settings you can add the following:
export http_proxy='http://172.27.100.5:4444/'
export https_proxy='http://172.27.100.5:4444/'
export ftp_proxy='http://172.27.100.5:4444/'
export no_proxy='localhost,127.0.0.0/8,::1
to your bash.bashrc file which is located in /etc folder. Of course, you should replace addresses with your ones. It works at least for Debian.

Where do I find the "cd" command? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
I need to know to know the full path of the command "cd" in ubuntu 10.04. Can anyone please help me find it. For example the full path of the command "dir" is "File System/bin/dir".
-Thanks in advance
cd is one of the builtin commands of bash (or similar shells).
/usr/bin/which screws up on shell builtins; type is a better alternative:
$ type cd
cd is a shell builtin

Resources