I have a GitHub project, (that I am working with (I didn't create it)), called OpenRefine, which I would like to encapsulate in a Docker image, such that other people can then pull that Docker image from the "Docker Hub" and have OpenRefine installed on their fundamental interactive Docker entity, viz. Image.
I want to then upload it to a repository that I can share with others.
It would be good if it had a name and not a crazy hash value.
Is it that I just create a "docker file" a text files with a git clone
command?
but then how to upload that to a repository such as the docker hub? I just put that text file there?
Something like
FROM ubuntu
MAINTAINER :/ WTF?!
RUN git clone blah
CMD what here?
This seems like a very basic issue but the information is not readily accessible in the Docker provided tutorials, nor is there a definitive answer on Stackoverflow, but those are indisputably excellent resources for a very complicated way to make a terminal output "Hello World".
While Sergius' answer isn't wrong, additional ways to do this would be through a Dockerfile https://docs.docker.com/reference/builder/. This way you can either include a Dockerfile in your github project and build that image to put up on docker hub. Or you can create a dockerfile that pulls your project from github, runs any necessary build steps and then push that to docker hub.
In either ways you would need to build the image from the dockerfile with
docker build -t <name of image> <OPTIONS> <build context>
and then you would use docker push
to push the image.
For a Dockerfile outside of your project:
FROM ubuntu:14.04
RUN apt-get install git && \
git clone <your git repo> && \
<additional bash commands for building your project>
CMD <command to run your project> # Can also use ENTRYPOINT in certain cases
I'm not sure, but you can try to fetch some basic docker image, which is suitable to run your application. Build your application there and use "docker commit" to get new image, which will contain that basic image with your application.
来源:https://stackoverflow.com/questions/32189877/creating-a-docker-image-for-a-github-project