Added minor spelling fix and tags to Dockerfile examples.
This commit is contained in:
parent
c7150a0644
commit
6cb4113f09
|
|
@ -9,7 +9,7 @@ The GNU Compiler Collection (GCC) is a compiler system produced by the GNU Proje
|
|||
|
||||
For this image, the most straight-forward use is to use a gcc container as both the build environment as well as the runtime environment. In your Dockerfile, you can do something along the lines of the following will compile and run your project.
|
||||
|
||||
FROM gcc
|
||||
FROM gcc:4.9
|
||||
ADD . /usr/src/myapp
|
||||
WORKDIR /usr/src/myapp
|
||||
RUN gcc -o myapp main.c
|
||||
|
|
@ -24,8 +24,8 @@ Then run the commands to build and run the docker image.
|
|||
|
||||
It is not always appropriate to run your app inside a container. In instances where you only want to compile inside the docker instance, you can do something along the lines of the following.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp gcc gcc -o myapp myapp.c
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp gcc:4.9 gcc -o myapp myapp.c
|
||||
|
||||
This will add your current directory as a volume to the comtainer, set the working directory to the volume, and run the command `gcc -o myapp myapp.c` which will tell gcc to compile the code in myapp.c and output the executable to myapp. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
This will add your current directory as a volume to the container, set the working directory to the volume, and run the command `gcc -o myapp myapp.c` which will tell gcc to compile the code in myapp.c and output the executable to myapp. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp gcc make
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp gcc:4.9 make
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ The GNU Compiler Collection (GCC) is a compiler system produced by the GNU Proje
|
|||
|
||||
For this image, the most straight-forward use is to use a gcc container as both the build environment as well as the runtime environment. In your Dockerfile, you can do something along the lines of the following will compile and run your project.
|
||||
|
||||
FROM gcc
|
||||
FROM gcc:4.9
|
||||
ADD . /usr/src/myapp
|
||||
WORKDIR /usr/src/myapp
|
||||
RUN gcc -o myapp main.c
|
||||
|
|
@ -24,11 +24,11 @@ Then run the commands to build and run the docker image.
|
|||
|
||||
It is not always appropriate to run your app inside a container. In instances where you only want to compile inside the docker instance, you can do something along the lines of the following.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp gcc gcc -o myapp myapp.c
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp gcc:4.9 gcc -o myapp myapp.c
|
||||
|
||||
This will add your current directory as a volume to the comtainer, set the working directory to the volume, and run the command `gcc -o myapp myapp.c` which will tell gcc to compile the code in myapp.c and output the executable to myapp. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
This will add your current directory as a volume to the container, set the working directory to the volume, and run the command `gcc -o myapp myapp.c` which will tell gcc to compile the code in myapp.c and output the executable to myapp. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp gcc make
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp gcc:4.9 make
|
||||
|
||||
# User Feedback
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@ Go, also called golang, is a programming language initially developed at Google
|
|||
|
||||
For this image, the most straight-forward use is to use a golang container as both the build environment as well as the runtime environment. In your Dockerfile, you can do something along the lines of the following will compile and run your project.
|
||||
|
||||
FROM golang
|
||||
ADD . /usr/src/myapp
|
||||
WORKDIR /usr/src/myapp
|
||||
RUN go build
|
||||
FROM golang:1.3-onbuild
|
||||
CMD ["./myapp"]
|
||||
|
||||
This image includes multiple `ONBUILD` triggers so that should be all that you need for most applications. The build will `COPY . /usr/src/app`, `RUN go get -d -v`, and `RUN go build -v`.
|
||||
|
||||
Then run and build the docker image.
|
||||
|
||||
docker build -t my-golang-app
|
||||
|
|
@ -24,8 +23,8 @@ Then run and build the docker image.
|
|||
|
||||
It is not always appropriate to run your app inside a container. In instances where you only want to compile inside the docker instance, you can do something along the lines of the following.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp golang go build
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp golang:1.3 go build -v
|
||||
|
||||
This will add your current directory as a volume to the comtainer, set the working directory to the volume, and run the command `go build` which will tell go to compile the project in the working directory and output the executable to myapp. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
This will add your current directory as a volume to the container, set the working directory to the volume, and run the command `go build` which will tell go to compile the project in the working directory and output the executable to myapp. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp make
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp golang:1.3 make
|
||||
|
|
|
|||
|
|
@ -9,12 +9,11 @@ Go, also called golang, is a programming language initially developed at Google
|
|||
|
||||
For this image, the most straight-forward use is to use a golang container as both the build environment as well as the runtime environment. In your Dockerfile, you can do something along the lines of the following will compile and run your project.
|
||||
|
||||
FROM golang
|
||||
ADD . /usr/src/myapp
|
||||
WORKDIR /usr/src/myapp
|
||||
RUN go build
|
||||
FROM golang:1.3-onbuild
|
||||
CMD ["./myapp"]
|
||||
|
||||
This image includes multiple `ONBUILD` triggers so that should be all that you need for most applications. The build will `COPY . /usr/src/app`, `RUN go get -d -v`, and `RUN go build -v`.
|
||||
|
||||
Then run and build the docker image.
|
||||
|
||||
docker build -t my-golang-app
|
||||
|
|
@ -24,11 +23,11 @@ Then run and build the docker image.
|
|||
|
||||
It is not always appropriate to run your app inside a container. In instances where you only want to compile inside the docker instance, you can do something along the lines of the following.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp golang go build
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp golang:1.3 go build -v
|
||||
|
||||
This will add your current directory as a volume to the comtainer, set the working directory to the volume, and run the command `go build` which will tell go to compile the project in the working directory and output the executable to myapp. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
This will add your current directory as a volume to the container, set the working directory to the volume, and run the command `go build` which will tell go to compile the project in the working directory and output the executable to myapp. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp make
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp golang:1.3 make
|
||||
|
||||
# User Feedback
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Java is a concurrent, class-based, object-oriented language specifically designed to have as few implementation dependencies as possible. It is inteneded to allow application developers to "write once, run anywhere", meaning that code that runs on one platform does not need to be recompiled to run on another.
|
||||
Java is a concurrent, class-based, object-oriented language specifically designed to have as few implementation dependencies as possible. It is intended to allow application developers to "write once, run anywhere", meaning that code that runs on one platform does not need to be recompiled to run on another.
|
||||
|
||||
Java is a registered trademark of Oracle and/or its affiliates.
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
|
|||
|
||||
For this image, the most straight-forward use is to use a java container as both the build environment as well as the runtime environment. In your Dockerfile, you can do something along the lines of the following will compile and run your project.
|
||||
|
||||
FROM java
|
||||
FROM java:7
|
||||
ADD . /usr/src/myapp
|
||||
WORKDIR /usr/src/myapp
|
||||
RUN javac Main.java
|
||||
|
|
@ -25,8 +25,8 @@ Then run the commands to build and run the docker image.
|
|||
|
||||
It is not always appropriate to run your app inside a container. In instances where you only want to compile inside the docker instance, you can do something along the lines of the following.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp java javac Main.java
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp java:7 javac Main.java
|
||||
|
||||
This will add your current directory as a volume to the comtainer, set the working directory to the volume, and run the command `javac Main.java` which will tell java to compile the code in Main.java and output the java class file to Main.class. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
This will add your current directory as a volume to the container, set the working directory to the volume, and run the command `javac Main.java` which will tell java to compile the code in Main.java and output the java class file to Main.class. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp java make
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp java:7 make
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ Then run the commands to build and run the docker image.
|
|||
|
||||
It is not always appropriate to run your app inside a container. In instances where you only want to compile inside the docker instance, you can do something along the lines of the following.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp java javac Main.java
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp java:7 javac Main.java
|
||||
|
||||
This will add your current directory as a volume to the container, set the working directory to the volume, and run the command `javac Main.java` which will tell java to compile the code in Main.java and output the java class file to Main.class. Alternatively, if you have a make file, you can instead run the make command inside your container.
|
||||
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp java make
|
||||
docker run --rm -v "$(pwd)":/usr/src/myapp -w /usr/src/myapp java:7 make
|
||||
|
||||
# User Feedback
|
||||
|
||||
|
|
|
|||
|
|
@ -9,16 +9,21 @@ Node.js internally uses the Google V8 JavaScript engine to execute code, and a l
|
|||
|
||||
# How to use this image
|
||||
|
||||
FROM node
|
||||
|
||||
ADD . /usr/src/app
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# install your application's dependencies
|
||||
RUN npm install
|
||||
## Create a `Dockerfile` in your nodejs app project.
|
||||
|
||||
FROM node:0.10.31-onbuild
|
||||
# replace this with your application's default port
|
||||
EXPOSE 8888
|
||||
|
||||
# replace this with your main "server" script file
|
||||
CMD [ "node", "server.js" ]
|
||||
|
||||
Then build and run the docker image.
|
||||
|
||||
docker build -t my-nodejs-app
|
||||
docker run -it --rm --name my-running-app my-nodejs-app
|
||||
|
||||
## Run a single nodejs script
|
||||
|
||||
For many single file projects, it may not be convenient to write a `Dockerfile` for your project. In such cases, you can run a nodejs script by using the nodejs docker image directly.
|
||||
|
||||
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp node:0.10.31 node your-daemon-or-script.rb
|
||||
|
|
|
|||
|
|
@ -9,20 +9,25 @@ Node.js internally uses the Google V8 JavaScript engine to execute code, and a l
|
|||
|
||||
# How to use this image
|
||||
|
||||
FROM node
|
||||
|
||||
ADD . /usr/src/app
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# install your application's dependencies
|
||||
RUN npm install
|
||||
## Create a `Dockerfile` in your nodejs app project.
|
||||
|
||||
FROM node:0.10.31-onbuild
|
||||
# replace this with your application's default port
|
||||
EXPOSE 8888
|
||||
|
||||
# replace this with your main "server" script file
|
||||
CMD [ "node", "server.js" ]
|
||||
|
||||
Then build and run the docker image.
|
||||
|
||||
docker build -t my-nodejs-app
|
||||
docker run -it --rm --name my-running-app my-nodejs-app
|
||||
|
||||
## Run a single nodejs script
|
||||
|
||||
For many single file projects, it may not be convenient to write a `Dockerfile` for your project. In such cases, you can run a nodejs script by using the nodejs docker image directly.
|
||||
|
||||
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp node:0.10.31 node your-daemon-or-script.rb
|
||||
|
||||
# User Feedback
|
||||
|
||||
## Issues
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Perl is a family of high-level, general-purpose, interpreted, dynamic programmin
|
|||
|
||||
## Create a `Dockerfile` in your perl app project.
|
||||
|
||||
FROM perl
|
||||
FROM perl:5.20
|
||||
ADD . /usr/src/myapp
|
||||
WORKDIR /usr/src/myapp
|
||||
CMD [ "perl", "./your-daemon-or-script.pl" ]
|
||||
|
|
@ -21,4 +21,4 @@ Then build and run the docker image.
|
|||
|
||||
For many single file projects, it may not be convenient to write a `Dockerfile` for your project. In such cases, you can run a perl script by using the perl docker image directly.
|
||||
|
||||
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp perl perl your-daemon-or-script.pl
|
||||
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp perl:5.20 perl your-daemon-or-script.pl
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Perl is a family of high-level, general-purpose, interpreted, dynamic programmin
|
|||
|
||||
## Create a `Dockerfile` in your perl app project.
|
||||
|
||||
FROM perl
|
||||
FROM perl:5.20
|
||||
ADD . /usr/src/myapp
|
||||
WORKDIR /usr/src/myapp
|
||||
CMD [ "perl", "./your-daemon-or-script.pl" ]
|
||||
|
|
@ -21,7 +21,7 @@ Then build and run the docker image.
|
|||
|
||||
For many single file projects, it may not be convenient to write a `Dockerfile` for your project. In such cases, you can run a perl script by using the perl docker image directly.
|
||||
|
||||
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp perl perl your-daemon-or-script.pl
|
||||
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp perl:5.20 perl your-daemon-or-script.pl
|
||||
|
||||
# User Feedback
|
||||
|
||||
|
|
|
|||
|
|
@ -6,23 +6,19 @@ Ruby on Rails, often simply referred to as Rails, is an open source web applicat
|
|||
|
||||
# How to use this image
|
||||
|
||||
## 1. create a `Dockerfile` in your rails app project
|
||||
|
||||
## Create a `Dockerfile` in your rails app project
|
||||
FROM rails:onbuild
|
||||
|
||||
Put this file in the root of your app, next to the `Gemfile`.
|
||||
|
||||
This image includes multiple `ONBUILD` triggers so that should be all that you need for most applications. The build will `ADD . /usr/src/app`, `RUN bundle install`, `EXPOSE 3000`, and set the default command to `rails server`.
|
||||
|
||||
## 2. build the rails app image
|
||||
Then build and run the docker image.
|
||||
|
||||
docker build -t my-rails-app .
|
||||
|
||||
## 3. start the rails app container
|
||||
|
||||
docker run --name some-rails-app -d my-rails-app
|
||||
|
||||
Then hit `http://container-ip:3000` in a browser. On the other hand, if you need access outside the host on port 8080:
|
||||
Test it by visiting `http://container-ip:3000` in a browser. On the other hand, if you need access outside the host on port 8080:
|
||||
|
||||
docker run --name some-rails-app -p 8080:3000 -d my-rails-app
|
||||
|
||||
|
|
|
|||
|
|
@ -6,23 +6,19 @@ Ruby on Rails, often simply referred to as Rails, is an open source web applicat
|
|||
|
||||
# How to use this image
|
||||
|
||||
## 1. create a `Dockerfile` in your rails app project
|
||||
|
||||
## Create a `Dockerfile` in your rails app project
|
||||
FROM rails:onbuild
|
||||
|
||||
Put this file in the root of your app, next to the `Gemfile`.
|
||||
|
||||
This image includes multiple `ONBUILD` triggers so that should be all that you need for most applications. The build will `ADD . /usr/src/app`, `RUN bundle install`, `EXPOSE 3000`, and set the default command to `rails server`.
|
||||
|
||||
## 2. build the rails app image
|
||||
Then build and run the docker image.
|
||||
|
||||
docker build -t my-rails-app .
|
||||
|
||||
## 3. start the rails app container
|
||||
|
||||
docker run --name some-rails-app -d my-rails-app
|
||||
|
||||
Then hit `http://container-ip:3000` in a browser. On the other hand, if you need access outside the host on port 8080:
|
||||
Test it by visiting `http://container-ip:3000` in a browser. On the other hand, if you need access outside the host on port 8080:
|
||||
|
||||
docker run --name some-rails-app -p 8080:3000 -d my-rails-app
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ According to its authors, Ruby was influenced by Perl, Smalltalk, Eiffel, Ada, a
|
|||
|
||||
## Create a `Dockerfile` in your ruby app project
|
||||
|
||||
FROM ruby:onbuild
|
||||
FROM ruby:2.1.2-onbuild
|
||||
CMD ["./your-daemon-or-script.rb"]
|
||||
|
||||
Put this file in the root of your app, next to the `Gemfile`.
|
||||
|
|
@ -25,4 +25,4 @@ Then build and run the ruby image.
|
|||
|
||||
For many single file projects, it may not be convenient to write a `Dockerfile` for your project. In such cases, you can run a ruby script by using the ruby docker image directly.
|
||||
|
||||
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp ruby ruby your-daemon-or-script.rb
|
||||
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp ruby:2.1.2 ruby your-daemon-or-script.rb
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ According to its authors, Ruby was influenced by Perl, Smalltalk, Eiffel, Ada, a
|
|||
|
||||
## Create a `Dockerfile` in your ruby app project
|
||||
|
||||
FROM ruby:onbuild
|
||||
FROM ruby:2.1.2-onbuild
|
||||
CMD ["./your-daemon-or-script.rb"]
|
||||
|
||||
Put this file in the root of your app, next to the `Gemfile`.
|
||||
|
|
@ -25,7 +25,7 @@ Then build and run the ruby image.
|
|||
|
||||
For many single file projects, it may not be convenient to write a `Dockerfile` for your project. In such cases, you can run a ruby script by using the ruby docker image directly.
|
||||
|
||||
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp ruby ruby your-daemon-or-script.rb
|
||||
docker run -it --rm --name my-running-script -v $(pwd):/usr/src/myapp -w /usr/src/myapp ruby:2.1.2 ruby your-daemon-or-script.rb
|
||||
|
||||
# User Feedback
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue