DockerFile: Difference between revisions

From DrewWiki
Jump to navigation Jump to search
(created DockerFile)
 
m (added ADD COPY and RUN to example Dockerfile)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
'''WIP''' A very boring container that installs curl and npm.
'''WIP''' A very boring container that installs curl and npm.
=Dockerfile=
=Dockerfile=
<syntaxhighlight>
<syntaxhighlight lang=bash>
FROM ubuntu:16.04
FROM ubuntu:16.04
MAINTAINER Drew Holt <[email protected]>
MAINTAINER Drew Holt <[email protected]>
Line 7: Line 7:
RUN apt-get update && apt-get install curl npm -y
RUN apt-get update && apt-get install curl npm -y


ENV FOO bar
ENV foo /bar
WORKDIR ${foo}  # WORKDIR /bar
ADD . $foo      # ADD . /bar
COPY \$foo /myapp # COPY $foo /myapp
 
RUN /myapp/myapp
</syntaxhighlight>
</syntaxhighlight>


=Build contanier=
=Build contanier=
<syntaxhighlight>
<syntaxhighlight lang=bash>
docker build -t drewderivative/mycontainer:0.0.1
docker build -t drewderivative/mycontainer:0.0.1
</syntaxhighlight>
</syntaxhighlight>


=Run container=
=Run container=
<syntaxhighlight>
<syntaxhighlight lang=bash>
docker run -p 8000:8888 drewderivative/mycontainer:0.0.1
docker run -p 8000:8888 drewderivative/mycontainer:0.0.1
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 14:50, 30 January 2018

WIP A very boring container that installs curl and npm.

Dockerfile

FROM ubuntu:16.04
MAINTAINER Drew Holt <[email protected]>

RUN apt-get update && apt-get install curl npm -y

ENV foo /bar
WORKDIR ${foo}   # WORKDIR /bar
ADD . $foo       # ADD . /bar
COPY \$foo /myapp # COPY $foo /myapp

RUN /myapp/myapp

Build contanier

docker build -t drewderivative/mycontainer:0.0.1

Run container

docker run -p 8000:8888 drewderivative/mycontainer:0.0.1