Docker - Using Local Image


#1

Hi, is there a way to use a local image without publish it to docker store or docker hub?

something like - image: ./.circleci/myLocalImageFolder/Dockerfile

sometimes you need the language image and the other dependecies (Ex: NodeJs)


#2

This is interesting idea. I’m afraid though it can increase build times so that you can’t really benefit from super fast image fetch + start of the 2.0 platform.


#3

We’d still have to pull in your code and build your image. You can already do that with multiple jobs, though I realize the versioning of the image could cause a problem. Maybe you need to add the sha and sed it on each build, or something more clever.

Here is the docs for multiple jobs:

https://circleci.com/docs/2.0/defining-multiple-jobs/


#4
FROM microsoft/dotnet:latest
RUN apt-get install npm

vs

- image: microsoft/dotnet:latest
- run: apt-get install npm

It seems the same but, but if I am using two or more containers i cant give commands to the ‘not first container’. With this, i can have all the dependencies ready in a container and have two databases in the same postgres database, for example.


#5

I recommend against using the “latest” tag for consistency reasons.

You can specify the cmd in which it executes. You should be able to pass whatever you need there.


#6

yeah, i know that latest is bad, only say it as example.

Are you saying that i can execute more than one command?

- image: anyImage:anyTag
  command: [ mycomand ]

Then, how can i execute more than one command?


#7

Oh-sorry. Don’t mean to nitpick :slight_smile:

For multiple commands, you should be able to use

- image: anyImage:anyTag
  command: [ "mycomand", "&&", "command2" ]

#8

Thanks roharab i will have this in consideration.

But i will be nice to have the ability to use local dockerfiles wihout the need of publish it to hub.docker or store.docker


#9

So, it is going to be implemented this in the future?


#10

I have my doubts but it’s only been 5 days since you opened this; no updates yet.

For what it is worth, it’s not really the Docker way. It would be cool, though.


#11

If you need it, i can write a proposal with: use cases, benefits, inconventients, examples, etc…


#12