Creating Dockerfile quickly - docker

I wanted a docker image with adoptopenjdk in alpine; installed with:
maven 3.6.3
kubectl latest
helm latest
git
maybe openshift
Is there a quick way to select a base image and then the aforementioned tools and get a Dockerfile, which I can further edit perhaps? It seems like something like that would be great to have and I expected it to be available. I went to Dockerhub and searching the tags, I can get maybe just the adoptopenjdk or maven or kubectl but not all-in-one bundle of my choosing. If there doesn't exist a thing like that what is the best way to go about it?

I would prefer pulling some separately, there’s none much differences thou.

Related

Build a production custom docker image of grafana from it github

I need make some changes on the code of grafana an them compile it.
I have downloaded the github repo, made the changes and rum
docker build -t custom-grafana -f Dockerfile .
As you can see many site over internet.
The problem is that compile in this way make a build from v7.5.0-dev version of grafana, and I need use the latest version...
I cant find de way to compile a custom grafana code using the latest version of gfrafana code.
I need help...
Thank you!
If you have cloned the grafana repository from GitHub than you must checkout the branch/tag that you want to compile.
The latest version at the moment is 7.5.6, you can just check it out before building the docker container.
git checkout v7.5.6

Jenkins + Artifactory in Red Hat

Good morning, I have a server with Red Hat Enterprise 7.6 (it can only be this one) installed and I have to install jenkins + jfrog artifactory.
The easiest way to do this would be with docker or installing them on the machine? The docker I already installed them but I do not know which is the most correct way to use them.
The docker seems to me better in the matter of I need to have other tools in that server and everything in container. In the future this machine will also have gitlab.
Thank you for your help
Docker Compose will be your best option and is the recommended option from JFrog's point of view for the scenario you're describing. We've added a bunch of examples of docker-compose scripts to our GitHub repos that should give you a great start.
You can user docker-compose tool.
Combine all required services in one yaml file.

How to tell the software version under a tag on Docker hub

I am quite newbie in docker, and I am trying to find the way to tell version for a docker hub tagged image.
For instance, the jenkins/jenkins:lts-latest image, listed here https://hub.docker.com/r/jenkins/jenkins/tags/, what image version does actually aliase? And how can I infer the correspondent dockerfile/branch in jenkins repo?
I tried with docker search but I couldn't. I tried also to find a clue in the official Jenkins github dockerfile repo: https://github.com/jenkinsci/docker, but I don't see any bindung tag or anything that gives me a hint on the source of the image
Another example, I have a Kubernetes cluster, and when I check my Nexus pod, I see likewise that the image is defined as sonatype/nexus3:latest.
In this case at least I have the imageID: docker-pullable://sonatype/nexus3#sha256:434a2564aa64646464afaf.. but once again I don't know how to map it to the actual version of the software
For the repo you asked, the answer is No.
When setup repo on dockerhub, there are two kinds of options for user to choose as follows:
1) Create Repository:
In this way, dockerhub just create a repo for user, and user need to build his own image on local server, tag it, and push it to dockerhub.
When user push his image to dockerhub, no additional information about the source version will be appended, so can't get any source map from dockerhub.
jenkins/jenkins, just this kind of repo.
2) Create Automated Build
In this way, dockerhub will fetch the code from github or bitbucket, and build the image on its cloud infrastructure, so it will know exactly what source commit is for current docker image.
jenkins/jnlp-slave, just this kind of repo.
Then, you can click its Build Details on the web page, click into one link, e.g. 3.26-1-alpine, you will see log mentioned 0a0239228bf2fd26d2458a91dd507e3c564bc7d0 is the source commit.
To sum up, for the repo you mentioned in the question, they are not Automated Build, so you cannot get the map for the image & source code, but if you happen to find a repo in dockerhub which is Automated Build later & want to know the map, then you can.
As long as I understand your question, you are trying to tag the docker image exact with same version as of your software version. For that I use to create image tag:
$ export VERSION="2.31-b19"
$ docker tag "<user>/<image>:${VERSION}" "<docker_hub_user>/<repo>:latest"
If this is not the case. Please explain your use case a bit more so that we can provide you a better workaround.

Setting up multi-stage Docker build on Heroku

[Edit: It looks like my specific question is how to push a multi-stage Docker build to Heroku]
I'm trying to set up a NLP server using the spacy-api-docker Github repository.
The project README lists a base image (jgontrum/spacyapi:base_v2) with no included language models as well an English language model image (jgontrum/spacyapi:en_v2) which is what I'm looking for.
When I pull and run the English language image the localhost API works perfectly, but when I try to build an image from the cloned Github repository the main Dockerfile seems to only build the base model (which is useless), and when I follow the steps listed in this heroku docker documentation and this other third party tutorial to push the container to Github it only seems to use that base Dockerfile - I can get the api running but it's useless with no models.
The repository also has a bunch of shorter language-specific Dockerfiles in a subfolder which I'm guessing need to be specified in some way? Just sticking the english Dockerfile after the main Dockerfile didn't work, at any rate.
My guess is that I might have to:
a. figure out how to push an image from Docker hub to Heroku without
a repository (the only image that's worked completely I pulled
directly from docker)
b. figure out how to make a repository from a
pulled image, which I can then make into a Heroku project with heroku
create
c. figure out how to specify the :en_v2 part when I build to
Heroku from the repository (is that a Docker tag? does it somehow
specify which additional Dockerfile to use?)
d. look into multi-stage Docker builds
I'm new to programming and have been banging my head against this for a while now, so would be very grateful for any pointers (and please pardon any terms I've used poorly, my vocabulary is pretty basic for this stuff).
Thanks!
What I can help you is just show sample code if just you wanna know how to setup multistage build and how to build.
I'm also using multistage build on Docker because several containers are required on this system and just show you related source code as below.
multistage build on Dockerfile
https://github.com/hiromaily/go-goa/blob/master/docker/Dockerfile.multistage.heroku
how to deploy to Heroku from travis-ci in my case
https://github.com/hiromaily/go-goa/blob/master/.travis.yml
I didn't read carefully, so if I miss that point, please ignore me.

Docker : Change open Jdk to oracle Jdk in Jenkins image

I am very new to docker and I am trying to run a Jenkins image. I pulled the image from the repository and now am able to run it using the command
docker run -p 8080:8080 jenkinsci/jenkins
By default it uses openjdk version 1.8. I would like to use oracle Jdk instead of openjdk. How could I change this? Thanks in advance.
If you really want to use this image and change the jdk, you will have to build your own image from this one, install oraclejdk, setup Jenkins to use this jdk (like environment variables etc), but it is not a clean way, imho.
The best practice would be to build your own image from a oraclejdk Docker image and setup Jenkins on it.
You should look at other Dockerfiles to do this.
Oracle provides a bunch of docker images on github : https://github.com/oracle/docker-images
You should check your other requirements as well (OS, etc.)

Resources