Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add source file in command line? #6072

Closed
ggaaooppeenngg opened this issue May 28, 2014 · 4 comments
Closed

How to add source file in command line? #6072

ggaaooppeenngg opened this issue May 28, 2014 · 4 comments

Comments

@ggaaooppeenngg
Copy link

I know I can add file with ADD in Dockerfile. But sometimes I just want to do some little test like go run main.go. And I just want to do like

docker add image main.go
docker commit id 
docker run id go run main.go

But I find no the feature in the command line reference.Do I miss something in the documentation, or there is no the feature?

@cyphar
Copy link
Contributor

cyphar commented May 28, 2014

There used to be a feature called docker insert. It is deprecated (and will be removed in 0.12 IIRC), in favor of Dockerfiles and the ADD directive. It is, however, being discussed whether docker cp allow bidirectional copying (rather than just container-to-host).

@ggaaooppeenngg
Copy link
Author

Could I pass some parameters to Dockerfile? like

#
#
# Dockerfile to run main.go 
# VERSION 2 - EDITION 1

# Base image used is ubuntu with golang installed

FROM ubuntu:golang

#remove main.go if exists
RUN rm -f /home/main.go


#add main.go source file
ADD **$SRCFILE** /home/main.go

#run main.go

CMD ["go","run","home/main.go"]

Could I pass the path as $SRCFILE in Dockerfile ?

Like run the shell

sed 's/SRCFILE/main.go/g' Seedfile > Dockerfile

@crosbymichael
Copy link
Contributor

Is this a dup of #5846 ?

@unclejack
Copy link
Contributor

@crosbymichael You're right, I'll close this in favor of #5846.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants