Friday, 21 April 2017

docker, make your base docker image, I

You don't have to make your base docker if you don't have any base images which could be reused in multi projects.

if you don't have the demand of making a base docker image, you still can read this post as a docker image knowledge tutorial.

Create Dockerfile:

basic docker file:

You can setup ENV and use them in the build file later:

Build the image: build command:

you don't have to user Dockerfile, you can use any file name. and specify the file name by -f:

build the  image with version: (it is not version  , it is a tag actually)

$ docker build -t whenry/fedora-jboss:latest -t whenry/fedora-jboss:v2.1 .

then later you can pull this image with specific version.

Push your image to docker hub

You need to run "docker login", and login with your docker hub account.

then push by:

docker push xxxxx/node

Run image:

run image with a entry point:
docker run --entrypoint

docker run xxx/node ls

ls is the command you want

No comments:

Post a comment