diff --git a/docs/sources/articles/runmetrics.md b/docs/sources/articles/runmetrics.md index 4cc210bb52..50d46047c0 100644 --- a/docs/sources/articles/runmetrics.md +++ b/docs/sources/articles/runmetrics.md @@ -26,7 +26,7 @@ corresponding to existing containers. To figure out where your control groups are mounted, you can run: - grep cgroup /proc/mounts + $ grep cgroup /proc/mounts ## Enumerating Cgroups @@ -287,7 +287,7 @@ an interface) can do some serious accounting. For instance, you can setup a rule to account for the outbound HTTP traffic on a web server: - iptables -I OUTPUT -p tcp --sport 80 + $ iptables -I OUTPUT -p tcp --sport 80 There is no `-j` or `-g` flag, so the rule will just count matched packets and go to the following @@ -295,7 +295,7 @@ rule. Later, you can check the values of the counters, with: - iptables -nxvL OUTPUT + $ iptables -nxvL OUTPUT Technically, `-n` is not required, but it will prevent iptables from doing DNS reverse lookups, which are probably @@ -337,11 +337,11 @@ though. The exact format of the command is: - ip netns exec + $ ip netns exec For example: - ip netns exec mycontainer netstat -i + $ ip netns exec mycontainer netstat -i `ip netns` finds the "mycontainer" container by using namespaces pseudo-files. Each process belongs to one network @@ -369,14 +369,13 @@ measure network usage. From there, you can examine the pseudo-file named control group (i.e. in the container). Pick any one of them. Putting everything together, if the "short ID" of a container is held in -the environment variable `$CID`, then you can do -this: +the environment variable `$CID`, then you can do this: - TASKS=/sys/fs/cgroup/devices/$CID*/tasks - PID=$(head -n 1 $TASKS) - mkdir -p /var/run/netns - ln -sf /proc/$PID/ns/net /var/run/netns/$CID - ip netns exec $CID netstat -i + $ TASKS=/sys/fs/cgroup/devices/$CID*/tasks + $ PID=$(head -n 1 $TASKS) + $ mkdir -p /var/run/netns + $ ln -sf /proc/$PID/ns/net /var/run/netns/$CID + $ ip netns exec $CID netstat -i ## Tips for high-performance metric collection diff --git a/docs/sources/contributing/devenvironment.md b/docs/sources/contributing/devenvironment.md index f7c66274e8..bcefa00369 100644 --- a/docs/sources/contributing/devenvironment.md +++ b/docs/sources/contributing/devenvironment.md @@ -32,8 +32,8 @@ Again, you can do it in other ways but you need to do more work. ## Check out the Source - git clone http://git@github.com/dotcloud/docker - cd docker + $ git clone http://git@github.com/dotcloud/docker + $ cd docker To checkout a different revision just use `git checkout` with the name of branch or revision number. @@ -45,7 +45,7 @@ Dockerfile in the current directory. Essentially, it will install all the build and runtime dependencies necessary to build and test Docker. This command will take some time to complete when you first execute it. - sudo make build + $ sudo make build If the build is successful, congratulations! You have produced a clean build of docker, neatly encapsulated in a standard build environment. @@ -54,7 +54,7 @@ build of docker, neatly encapsulated in a standard build environment. To create the Docker binary, run this command: - sudo make binary + $ sudo make binary This will create the Docker binary in `./bundles/-dev/binary/` @@ -65,7 +65,7 @@ The binary is available outside the container in the directory host docker executable with this binary for live testing - for example, on ubuntu: - sudo service docker stop ; sudo cp $(which docker) $(which docker)_ ; sudo cp ./bundles/-dev/binary/docker--dev $(which docker);sudo service docker start + $ sudo service docker stop ; sudo cp $(which docker) $(which docker)_ ; sudo cp ./bundles/-dev/binary/docker--dev $(which docker);sudo service docker start > **Note**: > Its safer to run the tests below before swapping your hosts docker binary. @@ -74,7 +74,7 @@ on ubuntu: To execute the test cases, run this command: - sudo make test + $ sudo make test If the test are successful then the tail of the output should look something like this @@ -105,11 +105,10 @@ something like this PASS ok github.com/dotcloud/docker/utils 0.017s -If $TESTFLAGS is set in the environment, it is passed as extra -arguments to `go test`. You can use this to select certain tests to run, -eg. +If $TESTFLAGS is set in the environment, it is passed as extra arguments +to `go test`. You can use this to select certain tests to run, e.g. - TESTFLAGS=`-run \^TestBuild\$` make test + $ TESTFLAGS=`-run \^TestBuild\$` make test If the output indicates "FAIL" and you see errors like this: @@ -124,7 +123,7 @@ is recommended. You can run an interactive session in the newly built container: - sudo make shell + $ sudo make shell # type 'exit' or Ctrl-D to exit @@ -134,7 +133,7 @@ If you want to read the documentation from a local website, or are making changes to it, you can build the documentation and then serve it by: - sudo make docs + $ sudo make docs # when its done, you can point your browser to http://yourdockerhost:8000 # type Ctrl-C to exit diff --git a/docs/sources/examples/cfengine_process_management.md b/docs/sources/examples/cfengine_process_management.md index 965ad252d2..0c7b6a8a1f 100644 --- a/docs/sources/examples/cfengine_process_management.md +++ b/docs/sources/examples/cfengine_process_management.md @@ -95,7 +95,7 @@ your container with the docker build command, e.g. Start the container with `apache2` and `sshd` running and managed, forwarding a port to our SSH instance: - docker run -p 127.0.0.1:222:22 -d managed_image "/usr/sbin/sshd" "/etc/init.d/apache2 start" + $ docker run -p 127.0.0.1:222:22 -d managed_image "/usr/sbin/sshd" "/etc/init.d/apache2 start" We now clearly see one of the benefits of the cfe-docker integration: it allows to start several processes as part of a normal `docker run` command. diff --git a/docs/sources/examples/couchdb_data_volumes.md b/docs/sources/examples/couchdb_data_volumes.md index 10abe7af02..17490487aa 100644 --- a/docs/sources/examples/couchdb_data_volumes.md +++ b/docs/sources/examples/couchdb_data_volumes.md @@ -20,28 +20,28 @@ different versions of CouchDB on the same data, etc. Note that we're marking `/var/lib/couchdb` as a data volume. - COUCH1=$(sudo docker run -d -p 5984 -v /var/lib/couchdb shykes/couchdb:2013-05-03) + $ COUCH1=$(sudo docker run -d -p 5984 -v /var/lib/couchdb shykes/couchdb:2013-05-03) ## Add data to the first database We're assuming your Docker host is reachable at `localhost`. If not, replace `localhost` with the public IP of your Docker host. - HOST=localhost - URL="http://$HOST:$(sudo docker port $COUCH1 5984 | grep -Po '\d+$')/_utils/" - echo "Navigate to $URL in your browser, and use the couch interface to add data" + $ HOST=localhost + $ URL="http://$HOST:$(sudo docker port $COUCH1 5984 | grep -Po '\d+$')/_utils/" + $ echo "Navigate to $URL in your browser, and use the couch interface to add data" ## Create second database This time, we're requesting shared access to `$COUCH1`'s volumes. - COUCH2=$(sudo docker run -d -p 5984 --volumes-from $COUCH1 shykes/couchdb:2013-05-03) + $ COUCH2=$(sudo docker run -d -p 5984 --volumes-from $COUCH1 shykes/couchdb:2013-05-03) ## Browse data on the second database - HOST=localhost - URL="http://$HOST:$(sudo docker port $COUCH2 5984 | grep -Po '\d+$')/_utils/" - echo "Navigate to $URL in your browser. You should see the same data as in the first database"'!' + $ HOST=localhost + $ URL="http://$HOST:$(sudo docker port $COUCH2 5984 | grep -Po '\d+$')/_utils/" + $ echo "Navigate to $URL in your browser. You should see the same data as in the first database"'!' Congratulations, you are now running two Couchdb containers, completely isolated from each other *except* for their data. diff --git a/docs/sources/examples/hello_world.md b/docs/sources/examples/hello_world.md index ba573527c1..48f4a43102 100644 --- a/docs/sources/examples/hello_world.md +++ b/docs/sources/examples/hello_world.md @@ -80,7 +80,7 @@ continue to do this until we stop it. **Steps:** - CONTAINER_ID=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done") + $ CONTAINER_ID=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done") We are going to run a simple hello world daemon in a new container made from the `ubuntu` image. @@ -98,7 +98,7 @@ from the `ubuntu` image. - sudo docker logs $container_id + $ sudo docker logs $container_id Check the logs make sure it is working correctly. @@ -107,7 +107,7 @@ Check the logs make sure it is working correctly. - sudo docker attach --sig-proxy=false $container_id + $ sudo docker attach --sig-proxy=false $container_id Attach to the container to see the results in real-time. @@ -120,7 +120,7 @@ Attach to the container to see the results in real-time. Exit from the container attachment by pressing Control-C. - sudo docker ps + $ sudo docker ps Check the process list to make sure it is running. @@ -128,7 +128,7 @@ Check the process list to make sure it is running. - sudo docker stop $container_id + $ sudo docker stop $container_id Stop the container, since we don't need it anymore. @@ -137,7 +137,7 @@ Stop the container, since we don't need it anymore. - sudo docker ps + $ sudo docker ps Make sure it is really stopped. diff --git a/docs/sources/examples/mongodb.md b/docs/sources/examples/mongodb.md index 36a5a58ad8..4b5f95d023 100644 --- a/docs/sources/examples/mongodb.md +++ b/docs/sources/examples/mongodb.md @@ -21,7 +21,7 @@ apt source and installs the database software on Ubuntu. Create an empty file called Dockerfile: - touch Dockerfile + $ touch Dockerfile Next, define the parent image you want to use to build your own image on top of. Here, we'll use [Ubuntu](https://index.docker.io/_/ubuntu/) @@ -69,21 +69,21 @@ container. Now, lets build the image which will go through the Dockerfile we made and run all of the commands. - sudo docker build -t /mongodb . + $ sudo docker build -t /mongodb . Now you should be able to run `mongod` as a daemon and be able to connect on the local port! # Regular style - MONGO_ID=$(sudo docker run -d /mongodb) + $ MONGO_ID=$(sudo docker run -d /mongodb) # Lean and mean - MONGO_ID=$(sudo docker run -d /mongodb --noprealloc --smallfiles) + $ MONGO_ID=$(sudo docker run -d /mongodb --noprealloc --smallfiles) # Check the logs out - sudo docker logs $MONGO_ID + $ sudo docker logs $MONGO_ID # Connect and play around - mongo --port + $ mongo --port Sweet! diff --git a/docs/sources/examples/nodejs_web_app.md b/docs/sources/examples/nodejs_web_app.md index f7d63dadcf..bc0e908d2d 100644 --- a/docs/sources/examples/nodejs_web_app.md +++ b/docs/sources/examples/nodejs_web_app.md @@ -134,16 +134,16 @@ Go to the directory that has your `Dockerfile` and run the following command to build a Docker image. The `-t` flag let's you tag your image so it's easier to find later using the `docker images` command: - sudo docker build -t /centos-node-hello . + $ sudo docker build -t /centos-node-hello . Your image will now be listed by Docker: - sudo docker images + $ sudo docker images - > # Example - > REPOSITORY TAG ID CREATED - > centos 6.4 539c0211cd76 8 weeks ago - > gasi/centos-node-hello latest d64d3505b0d2 2 hours ago + # Example + REPOSITORY TAG ID CREATED + centos 6.4 539c0211cd76 8 weeks ago + gasi/centos-node-hello latest d64d3505b0d2 2 hours ago ## Run the image @@ -151,44 +151,44 @@ Running your image with `-d` runs the container in detached mode, leaving the container running in the background. The `-p` flag redirects a public port to a private port in the container. Run the image you previously built: - sudo docker run -p 49160:8080 -d /centos-node-hello + $ sudo docker run -p 49160:8080 -d /centos-node-hello Print the output of your app: # Get container ID - sudo docker ps + $ sudo docker ps # Print app output - sudo docker logs + $ sudo docker logs - > # Example - > Running on http://localhost:8080 + # Example + Running on http://localhost:8080 ## Test To test your app, get the the port of your app that Docker mapped: - sudo docker ps + $ sudo docker ps - > # Example - > ID IMAGE COMMAND ... PORTS - > ecce33b30ebf gasi/centos-node-hello:latest node /src/index.js 49160->8080 + # Example + ID IMAGE COMMAND ... PORTS + ecce33b30ebf gasi/centos-node-hello:latest node /src/index.js 49160->8080 In the example above, Docker mapped the `8080` port of the container to `49160`. Now you can call your app using `curl` (install if needed via: `sudo apt-get install curl`): - curl -i localhost:49160 + $ curl -i localhost:49160 - > HTTP/1.1 200 OK - > X-Powered-By: Express - > Content-Type: text/html; charset=utf-8 - > Content-Length: 12 - > Date: Sun, 02 Jun 2013 03:53:22 GMT - > Connection: keep-alive - > - > Hello World + HTTP/1.1 200 OK + X-Powered-By: Express + Content-Type: text/html; charset=utf-8 + Content-Length: 12 + Date: Sun, 02 Jun 2013 03:53:22 GMT + Connection: keep-alive + + Hello World We hope this tutorial helped you get up and running with Node.js and CentOS on Docker. You can get the full source code at diff --git a/docs/sources/examples/postgresql_service.md b/docs/sources/examples/postgresql_service.md index 1a10cd4415..14d9e647a3 100644 --- a/docs/sources/examples/postgresql_service.md +++ b/docs/sources/examples/postgresql_service.md @@ -125,14 +125,14 @@ prompt, you can create a table and populate it. psql (9.3.1) Type "help" for help. - docker=# CREATE TABLE cities ( + $ docker=# CREATE TABLE cities ( docker(# name varchar(80), docker(# location point docker(# ); CREATE TABLE - docker=# INSERT INTO cities VALUES ('San Francisco', '(-194.0, 53.0)'); + $ docker=# INSERT INTO cities VALUES ('San Francisco', '(-194.0, 53.0)'); INSERT 0 1 - docker=# select * from cities; + $ docker=# select * from cities; name | location ---------------+----------- San Francisco | (-194,53) @@ -143,7 +143,7 @@ prompt, you can create a table and populate it. You can use the defined volumes to inspect the PostgreSQL log files and to backup your configuration and data: - docker run -rm --volumes-from pg_test -t -i busybox sh + $ docker run -rm --volumes-from pg_test -t -i busybox sh / # ls bin etc lib linuxrc mnt proc run sys usr diff --git a/docs/sources/examples/running_redis_service.md b/docs/sources/examples/running_redis_service.md index 2bfa8a05bc..ca67048625 100644 --- a/docs/sources/examples/running_redis_service.md +++ b/docs/sources/examples/running_redis_service.md @@ -29,7 +29,7 @@ image. Next we build an image from our `Dockerfile`. Replace `` with your own user name. - sudo docker build -t /redis . + $ sudo docker build -t /redis . ## Run the service @@ -42,7 +42,7 @@ Importantly, we're not exposing any ports on our container. Instead we're going to use a container link to provide access to our Redis database. - sudo docker run --name redis -d /redis + $ sudo docker run --name redis -d /redis ## Create your web application container @@ -52,19 +52,19 @@ created with an alias of `db`. This will create a secure tunnel to the `redis` container and expose the Redis instance running inside that container to only this container. - sudo docker run --link redis:db -i -t ubuntu:12.10 /bin/bash + $ sudo docker run --link redis:db -i -t ubuntu:12.10 /bin/bash Once inside our freshly created container we need to install Redis to get the `redis-cli` binary to test our connection. - apt-get update - apt-get -y install redis-server - service redis-server stop + $ apt-get update + $ apt-get -y install redis-server + $ service redis-server stop As we've used the `--link redis:db` option, Docker has created some environment variables in our web application container. - env | grep DB_ + $ env | grep DB_ # Should return something similar to this with your values DB_NAME=/violet_wolf/db @@ -79,13 +79,13 @@ with `DB`. The `DB` comes from the link alias specified when we launched the container. Let's use the `DB_PORT_6379_TCP_ADDR` variable to connect to our Redis container. - redis-cli -h $DB_PORT_6379_TCP_ADDR - redis 172.17.0.33:6379> - redis 172.17.0.33:6379> set docker awesome + $ redis-cli -h $DB_PORT_6379_TCP_ADDR + $ redis 172.17.0.33:6379> + $ redis 172.17.0.33:6379> set docker awesome OK - redis 172.17.0.33:6379> get docker + $ redis 172.17.0.33:6379> get docker "awesome" - redis 172.17.0.33:6379> exit + $ redis 172.17.0.33:6379> exit We could easily use this or other environment variables in our web application to make a connection to our `redis` diff --git a/docs/sources/examples/running_riak_service.md b/docs/sources/examples/running_riak_service.md index 61594f9cd8..852035f9a4 100644 --- a/docs/sources/examples/running_riak_service.md +++ b/docs/sources/examples/running_riak_service.md @@ -19,7 +19,7 @@ Riak pre-installed. Create an empty file called Dockerfile: - touch Dockerfile + $ touch Dockerfile Next, define the parent image you want to use to build your image on top of. We'll use [Ubuntu](https://index.docker.io/_/ubuntu/) (tag: @@ -126,7 +126,7 @@ Populate it with the following program definitions: Now you should be able to build a Docker image for Riak: - docker build -t "/riak" . + $ docker build -t "/riak" . ## Next steps diff --git a/docs/sources/examples/using_supervisord.md b/docs/sources/examples/using_supervisord.md index 8e85ae05d2..29d2fa4525 100644 --- a/docs/sources/examples/using_supervisord.md +++ b/docs/sources/examples/using_supervisord.md @@ -99,13 +99,13 @@ launches. We can now build our new container. - sudo docker build -t /supervisord . + $ sudo docker build -t /supervisord . ## Running our Supervisor container Once We've got a built image we can launch a container from it. - sudo docker run -p 22 -p 80 -t -i /supervisord + $ sudo docker run -p 22 -p 80 -t -i /supervisord 2013-11-25 18:53:22,312 CRIT Supervisor running as root (no user in config file) 2013-11-25 18:53:22,312 WARN Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing 2013-11-25 18:53:22,342 INFO supervisord started with pid 1 diff --git a/docs/sources/installation/archlinux.md b/docs/sources/installation/archlinux.md index 6e970b96f6..c6d4f73fb8 100644 --- a/docs/sources/installation/archlinux.md +++ b/docs/sources/installation/archlinux.md @@ -60,8 +60,8 @@ have not done so before. There is a systemd service unit created for docker. To start the docker service: - sudo systemctl start docker + $ sudo systemctl start docker To start on system boot: - sudo systemctl enable docker + $ sudo systemctl enable docker diff --git a/docs/sources/installation/binaries.md b/docs/sources/installation/binaries.md index b02c28828b..36aa0ae249 100644 --- a/docs/sources/installation/binaries.md +++ b/docs/sources/installation/binaries.md @@ -46,8 +46,8 @@ Linux kernel (it even builds on OSX!). ## Get the docker binary: - wget https://get.docker.io/builds/Linux/x86_64/docker-latest -O docker - chmod +x docker + $ wget https://get.docker.io/builds/Linux/x86_64/docker-latest -O docker + $ chmod +x docker > **Note**: > If you have trouble downloading the binary, you can also get the smaller @@ -58,7 +58,7 @@ Linux kernel (it even builds on OSX!). ## Run the docker daemon # start the docker in daemon mode from the directory you unpacked - sudo ./docker -d & + $ sudo ./docker -d & ## Giving non-root access @@ -87,16 +87,16 @@ all the client commands. To upgrade your manual installation of Docker, first kill the docker daemon: - killall docker + $ killall docker Then follow the regular installation steps. ## Run your first container! # check your docker version - sudo ./docker version + $ sudo ./docker version # run a container and open an interactive shell in the container - sudo ./docker run -i -t ubuntu /bin/bash + $ sudo ./docker run -i -t ubuntu /bin/bash Continue with the [*Hello World*](/examples/hello_world/#hello-world) example. diff --git a/docs/sources/installation/cruxlinux.md b/docs/sources/installation/cruxlinux.md index f37d720389..d1a4de7367 100644 --- a/docs/sources/installation/cruxlinux.md +++ b/docs/sources/installation/cruxlinux.md @@ -39,24 +39,24 @@ do so via: Download the `httpup` file to `/etc/ports/`: - curl -q -o - http://crux.nu/portdb/?a=getup&q=prologic > /etc/ports/prologic.httpup + $ curl -q -o - http://crux.nu/portdb/?a=getup&q=prologic > /etc/ports/prologic.httpup Add `prtdir /usr/ports/prologic` to `/etc/prt-get.conf`: - vim /etc/prt-get.conf + $ vim /etc/prt-get.conf # or: - echo "prtdir /usr/ports/prologic" >> /etc/prt-get.conf + $ echo "prtdir /usr/ports/prologic" >> /etc/prt-get.conf Update ports and prt-get cache: - ports -u - prt-get cache + $ ports -u + $ prt-get cache To install (*and its dependencies*): - prt-get depinst docker + $ prt-get depinst docker Use `docker-bin` for the upstream binary or `docker-git` to build and install from the master @@ -70,20 +70,20 @@ and Docker Daemon to work properly. Please read the `README.rst`: - prt-get readme docker + $ prt-get readme docker There is a `test_kernel_config.sh` script in the above ports which you can use to test your Kernel configuration: - cd /usr/ports/prologic/docker - ./test_kernel_config.sh /usr/src/linux/.config + $ cd /usr/ports/prologic/docker + $ ./test_kernel_config.sh /usr/src/linux/.config ## Starting Docker There is a rc script created for Docker. To start the Docker service: - sudo su - - /etc/rc.d/docker start + $ sudo su - + $ /etc/rc.d/docker start To start on system boot: diff --git a/docs/sources/installation/fedora.md b/docs/sources/installation/fedora.md index 70d8c1462e..93b5b05b13 100644 --- a/docs/sources/installation/fedora.md +++ b/docs/sources/installation/fedora.md @@ -30,35 +30,35 @@ report](https://bugzilla.redhat.com/show_bug.cgi?id=1043676) filed for it. To proceed with `docker-io` installation on Fedora 19, please remove `docker` first. - sudo yum -y remove docker + $ sudo yum -y remove docker For Fedora 20 and later, the `wmdocker` package will provide the same functionality as `docker` and will also not conflict with `docker-io`. - sudo yum -y install wmdocker - sudo yum -y remove docker + $ sudo yum -y install wmdocker + $ sudo yum -y remove docker Install the `docker-io` package which will install Docker on our host. - sudo yum -y install docker-io + $ sudo yum -y install docker-io To update the `docker-io` package: - sudo yum -y update docker-io + $ sudo yum -y update docker-io Now that it's installed, let's start the Docker daemon. - sudo systemctl start docker + $ sudo systemctl start docker If we want Docker to start at boot, we should also: - sudo systemctl enable docker + $ sudo systemctl enable docker Now let's verify that Docker is working. - sudo docker run -i -t fedora /bin/bash + $ sudo docker run -i -t fedora /bin/bash **Done!**, now continue with the [*Hello World*](/examples/hello_world/#hello-world) example. diff --git a/docs/sources/installation/frugalware.md b/docs/sources/installation/frugalware.md index 1d640cf8fd..eb409d8d39 100644 --- a/docs/sources/installation/frugalware.md +++ b/docs/sources/installation/frugalware.md @@ -49,8 +49,8 @@ is all that is needed. There is a systemd service unit created for Docker. To start Docker as service: - sudo systemctl start lxc-docker + $ sudo systemctl start lxc-docker To start on system boot: - sudo systemctl enable lxc-docker + $ sudo systemctl enable lxc-docker diff --git a/docs/sources/installation/gentoolinux.md b/docs/sources/installation/gentoolinux.md index 49700ea563..92329dca90 100644 --- a/docs/sources/installation/gentoolinux.md +++ b/docs/sources/installation/gentoolinux.md @@ -43,7 +43,7 @@ use flags to pull in the proper dependencies of the major storage drivers, with the "device-mapper" use flag being enabled by default, since that is the simplest installation path. - sudo emerge -av app-emulation/docker + $ sudo emerge -av app-emulation/docker If any issues arise from this ebuild or the resulting binary, including and especially missing kernel configuration flags and/or dependencies, @@ -61,18 +61,18 @@ and/or AUFS, depending on the storage driver you`ve decided to use). To start the docker daemon: - sudo /etc/init.d/docker start + $ sudo /etc/init.d/docker start To start on system boot: - sudo rc-update add docker default + $ sudo rc-update add docker default ### systemd To start the docker daemon: - sudo systemctl start docker.service + $ sudo systemctl start docker.service To start on system boot: - sudo systemctl enable docker.service + $ sudo systemctl enable docker.service diff --git a/docs/sources/installation/google.md b/docs/sources/installation/google.md index bec7d0ba13..4c22808dcb 100644 --- a/docs/sources/installation/google.md +++ b/docs/sources/installation/google.md @@ -45,19 +45,19 @@ page_keywords: Docker, Docker documentation, installation, google, Google Comput $ gcutil ssh docker-playground - docker-playground:~$ + $ docker-playground:~$ 5. Install the latest Docker release and configure it to start when the instance boots: - docker-playground:~$ curl get.docker.io | bash - docker-playground:~$ sudo update-rc.d docker defaults + $ docker-playground:~$ curl get.docker.io | bash + $ docker-playground:~$ sudo update-rc.d docker defaults 6. Start a new container: - docker-playground:~$ sudo docker run busybox echo 'docker on GCE \o/' - docker on GCE \o/ + $ docker-playground:~$ sudo docker run busybox echo 'docker on GCE \o/' + $ docker on GCE \o/ diff --git a/docs/sources/installation/mac.md b/docs/sources/installation/mac.md index 1cef06b55b..15736f5c6c 100644 --- a/docs/sources/installation/mac.md +++ b/docs/sources/installation/mac.md @@ -40,7 +40,7 @@ image that is used for the job. If you are using Homebrew on your machine, simply run the following command to install `boot2docker`: - brew install boot2docker + $ brew install boot2docker #### Manual installation @@ -49,13 +49,13 @@ Open up a new terminal window, if you have not already. Run the following commands to get boot2docker: # Enter the installation directory - cd ~/bin + $ cd ~/bin # Get the file - curl https://raw.github.com/boot2docker/boot2docker/master/boot2docker > boot2docker + $ curl https://raw.github.com/boot2docker/boot2docker/master/boot2docker > boot2docker # Mark it executable - chmod +x boot2docker + $ chmod +x boot2docker ### Docker OS X Client @@ -67,25 +67,25 @@ The `docker` daemon is accessed using the Run the following command to install the `docker` client: - brew install docker + $ brew install docker #### Manual installation Run the following commands to get it downloaded and set up: # Get the docker client file - DIR=$(mktemp -d ${TMPDIR:-/tmp}/dockerdl.XXXXXXX) && \ - curl -f -o $DIR/ld.tgz https://get.docker.io/builds/Darwin/x86_64/docker-latest.tgz && \ - gunzip $DIR/ld.tgz && \ - tar xvf $DIR/ld.tar -C $DIR/ && \ - cp $DIR/usr/local/bin/docker ./docker + $ DIR=$(mktemp -d ${TMPDIR:-/tmp}/dockerdl.XXXXXXX) && \ + $ curl -f -o $DIR/ld.tgz https://get.docker.io/builds/Darwin/x86_64/docker-latest.tgz && \ + $ gunzip $DIR/ld.tgz && \ + $ tar xvf $DIR/ld.tar -C $DIR/ && \ + $ cp $DIR/usr/local/bin/docker ./docker # Set the environment variable for the docker daemon - export DOCKER_HOST=tcp://127.0.0.1:4243 + $ export DOCKER_HOST=tcp://127.0.0.1:4243 # Copy the executable file - sudo mkdir -p /usr/local/bin - sudo cp docker /usr/local/bin/ + $ sudo mkdir -p /usr/local/bin + $ sudo cp docker /usr/local/bin/ And that's it! Let's check out how to use it. @@ -97,13 +97,13 @@ Inside the `~/bin` directory, run the following commands: # Initiate the VM - ./boot2docker init + $ ./boot2docker init # Run the VM (the docker daemon) - ./boot2docker up + $ ./boot2docker up # To see all available commands: - ./boot2docker + $ ./boot2docker # Usage ./boot2docker {init|start|up|pause|stop|restart|status|info|delete|ssh|download} @@ -113,7 +113,7 @@ Once the VM with the `docker` daemon is up, you can use the `docker` client just like any other application. - docker version + $ docker version # Client version: 0.7.6 # Go version (client): go1.2 # Git commit (client): bc3b2ec @@ -137,7 +137,7 @@ interact with our containers as if they were running locally: If you feel the need to connect to the VM, you can simply run: - ./boot2docker ssh + $ ./boot2docker ssh # User: docker # Pwd: tcuser @@ -154,7 +154,7 @@ See the GitHub page for ### If SSH complains about keys: - ssh-keygen -R '[localhost]:2022' + $ ssh-keygen -R '[localhost]:2022' ### Upgrading to a newer release of boot2docker @@ -162,9 +162,9 @@ To upgrade an initialised VM, you can use the following 3 commands. Your persistence disk will not be changed, so you won't lose your images and containers: - ./boot2docker stop - ./boot2docker download - ./boot2docker start + $ ./boot2docker stop + $ ./boot2docker download + $ ./boot2docker start ### About the way Docker works on Mac OS X: diff --git a/docs/sources/installation/openSUSE.md b/docs/sources/installation/openSUSE.md index 2d7804d291..07f2ca43d2 100644 --- a/docs/sources/installation/openSUSE.md +++ b/docs/sources/installation/openSUSE.md @@ -30,14 +30,14 @@ To proceed with Docker installation please add the right Virtualization repository. # openSUSE 12.3 - sudo zypper ar -f http://download.opensuse.org/repositories/Virtualization/openSUSE_12.3/ Virtualization + $ sudo zypper ar -f http://download.opensuse.org/repositories/Virtualization/openSUSE_12.3/ Virtualization # openSUSE 13.1 - sudo zypper ar -f http://download.opensuse.org/repositories/Virtualization/openSUSE_13.1/ Virtualization + $ sudo zypper ar -f http://download.opensuse.org/repositories/Virtualization/openSUSE_13.1/ Virtualization Install the Docker package. - sudo zypper in docker + $ sudo zypper in docker It's also possible to install Docker using openSUSE's1-click install. Just visit [this](http://software.opensuse.org/package/docker) page, @@ -47,17 +47,17 @@ the docker package. Now that it's installed, let's start the Docker daemon. - sudo systemctl start docker + $ sudo systemctl start docker If we want Docker to start at boot, we should also: - sudo systemctl enable docker + $ sudo systemctl enable docker The docker package creates a new group named docker. Users, other than root user, need to be part of this group in order to interact with the Docker daemon. - sudo usermod -G docker + $ sudo usermod -G docker **Done!** Now continue with the [*Hello World*]( diff --git a/docs/sources/installation/rackspace.md b/docs/sources/installation/rackspace.md index 8cce292b79..c93af388ed 100644 --- a/docs/sources/installation/rackspace.md +++ b/docs/sources/installation/rackspace.md @@ -29,16 +29,16 @@ you will need to set the kernel manually. **Do not attempt this on a production machine!** # update apt - apt-get update + $ apt-get update # install the new kernel - apt-get install linux-generic-lts-raring + $ apt-get install linux-generic-lts-raring Great, now you have the kernel installed in `/boot/`, next you need to make it boot next time. # find the exact names - find /boot/ -name '*3.8*' + $ find /boot/ -name '*3.8*' # this should return some results @@ -51,7 +51,7 @@ the right files. Take special care to double check the kernel and initrd entries. # now edit /boot/grub/menu.lst - vi /boot/grub/menu.lst + $ vi /boot/grub/menu.lst It will probably look something like this: @@ -78,7 +78,7 @@ Reboot the server (either via command line or console) Verify the kernel was updated - uname -a + $ uname -a # Linux docker-12-04 3.8.0-19-generic #30~precise1-Ubuntu SMP Wed May 1 22:26:36 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux # nice! 3.8. diff --git a/docs/sources/installation/rhel.md b/docs/sources/installation/rhel.md index 874e92adc8..632743a2b9 100644 --- a/docs/sources/installation/rhel.md +++ b/docs/sources/installation/rhel.md @@ -49,23 +49,23 @@ To proceed with `docker-io` installation, please remove `docker` first. Next, let's install the `docker-io` package which will install Docker on our host. - sudo yum -y install docker-io + $ sudo yum -y install docker-io To update the `docker-io` package - sudo yum -y update docker-io + $ sudo yum -y update docker-io Now that it's installed, let's start the Docker daemon. - sudo service docker start + $ sudo service docker start If we want Docker to start at boot, we should also: - sudo chkconfig docker on + $ sudo chkconfig docker on Now let's verify that Docker is working. - sudo docker run -i -t fedora /bin/bash + $ sudo docker run -i -t fedora /bin/bash **Done!** Now continue with the [*Hello World*](/examples/hello_world/#hello-world) example. diff --git a/docs/sources/installation/ubuntulinux.md b/docs/sources/installation/ubuntulinux.md index 04173cf917..d40e17b646 100644 --- a/docs/sources/installation/ubuntulinux.md +++ b/docs/sources/installation/ubuntulinux.md @@ -33,13 +33,13 @@ installs all its prerequisites from Ubuntu's repository. To install the latest Ubuntu package (may not be the latest Docker release): - sudo apt-get update - sudo apt-get install docker.io - sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker + $ sudo apt-get update + $ sudo apt-get install docker.io + $ sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker To verify that everything has worked as expected: - sudo docker run -i -t ubuntu /bin/bash + $ sudo docker run -i -t ubuntu /bin/bash Which should download the `ubuntu` image, and then start `bash` in a container. @@ -61,11 +61,11 @@ VirtualBox guest additions. If you didn't install the headers for your kernel. But it is safer to include them if you're not sure. # install the backported kernel - sudo apt-get update - sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring + $ sudo apt-get update + $ sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring # reboot - sudo reboot + $ sudo reboot ### Installation @@ -90,7 +90,7 @@ should exist. If it doesn't, you need to install the package Then, add the Docker repository key to your local keychain. - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 + $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 Add the Docker repository to your apt sources list, update and install the `lxc-docker` package. @@ -98,21 +98,21 @@ the `lxc-docker` package. *You may receive a warning that the package isn't trusted. Answer yes to continue installation.* - sudo sh -c "echo deb https://get.docker.io/ubuntu docker main\ + $ sudo sh -c "echo deb https://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list" - sudo apt-get update - sudo apt-get install lxc-docker + $ sudo apt-get update + $ sudo apt-get install lxc-docker > **Note**: > > There is also a simple `curl` script available to help with this process. > -> curl -s https://get.docker.io/ubuntu/ | sudo sh +> $ curl -s https://get.docker.io/ubuntu/ | sudo sh Now verify that the installation has worked by downloading the `ubuntu` image and launching a container. - sudo docker run -i -t ubuntu /bin/bash + $ sudo docker run -i -t ubuntu /bin/bash Type `exit` to exit @@ -134,8 +134,8 @@ available as a driver and we recommend using it if you can. To make sure AUFS is installed, run the following commands: - sudo apt-get update - sudo apt-get install linux-image-extra-`uname -r` + $ sudo apt-get update + $ sudo apt-get install linux-image-extra-`uname -r` ### Installation @@ -147,20 +147,20 @@ Docker is available as a Debian package, which makes installation easy. First add the Docker repository key to your local keychain. - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 + $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 Add the Docker repository to your apt sources list, update and install the `lxc-docker` package. - sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ + $ sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\ > /etc/apt/sources.list.d/docker.list" - sudo apt-get update - sudo apt-get install lxc-docker + $ sudo apt-get update + $ sudo apt-get install lxc-docker Now verify that the installation has worked by downloading the `ubuntu` image and launching a container. - sudo docker run -i -t ubuntu /bin/bash + $ sudo docker run -i -t ubuntu /bin/bash Type `exit` to exit @@ -194,16 +194,16 @@ than `docker` should own the Unix socket with the **Example:** # Add the docker group if it doesn't already exist. - sudo groupadd docker + $ sudo groupadd docker # Add the connected user "${USER}" to the docker group. # Change the user name to match your preferred user. # You may have to logout and log back in again for # this to take effect. - sudo gpasswd -a ${USER} docker + $ sudo gpasswd -a ${USER} docker # Restart the Docker daemon. - sudo service docker restart + $ sudo service docker restart ### Upgrade @@ -211,28 +211,28 @@ To install the latest version of docker, use the standard `apt-get` method: # update your sources list - sudo apt-get update + $ sudo apt-get update # install the latest - sudo apt-get install lxc-docker + $ sudo apt-get install lxc-docker ## Memory and Swap Accounting If you want to enable memory and swap accounting, you must add the following command-line parameters to your kernel: - cgroup_enable=memory swapaccount=1 + $ cgroup_enable=memory swapaccount=1 On systems using GRUB (which is the default for Ubuntu), you can add those parameters by editing `/etc/default/grub` and extending `GRUB_CMDLINE_LINUX`. Look for the following line: - GRUB_CMDLINE_LINUX="" + $ GRUB_CMDLINE_LINUX="" And replace it by the following one: - GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1" + $ GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1" Then run `sudo update-grub`, and reboot. @@ -247,7 +247,7 @@ On Linux Mint, the `cgroup-lite` package is not installed by default. Before Docker will work correctly, you will need to install this via: - sudo apt-get update && sudo apt-get install cgroup-lite + $ sudo apt-get update && sudo apt-get install cgroup-lite ## Docker and UFW @@ -255,22 +255,22 @@ Docker uses a bridge to manage container networking. By default, UFW drops all forwarding traffic. As a result you will need to enable UFW forwarding: - sudo nano /etc/default/ufw - ---- + $ sudo nano /etc/default/ufw + # Change: # DEFAULT_FORWARD_POLICY="DROP" # to - DEFAULT_FORWARD_POLICY="ACCEPT" + $ DEFAULT_FORWARD_POLICY="ACCEPT" Then reload UFW: - sudo ufw reload + $ sudo ufw reload UFW's default set of rules denies all incoming traffic. If you want to be able to reach your containers from another host then you should allow incoming connections on the Docker port (default 4243): - sudo ufw allow 4243/tcp + $ sudo ufw allow 4243/tcp ## Docker and local DNS server warnings @@ -290,16 +290,16 @@ nameserver and Docker will default to using an external nameserver. This can be worked around by specifying a DNS server to be used by the Docker daemon for the containers: - sudo nano /etc/default/docker + $ sudo nano /etc/default/docker --- # Add: - DOCKER_OPTS="--dns 8.8.8.8" + $ docker_OPTS="--dns 8.8.8.8" # 8.8.8.8 could be replaced with a local DNS server, such as 192.168.1.1 # multiple DNS servers can be specified: --dns 8.8.8.8 --dns 192.168.1.1 The Docker daemon has to be restarted: - sudo restart docker + $ sudo restart docker > **Warning**: > If you're doing this on a laptop which connects to various networks, @@ -308,7 +308,7 @@ The Docker daemon has to be restarted: An alternative solution involves disabling dnsmasq in NetworkManager by following these steps: - sudo nano /etc/NetworkManager/NetworkManager.conf + $ sudo nano /etc/NetworkManager/NetworkManager.conf ---- # Change: dns=dnsmasq @@ -317,8 +317,8 @@ following these steps: NetworkManager and Docker need to be restarted afterwards: - sudo restart network-manager - sudo restart docker + $ sudo restart network-manager + $ sudo restart docker > **Warning**: This might make DNS resolution slower on some networks. @@ -336,7 +336,7 @@ Substitute `http://mirror.yandex.ru/mirrors/docker/` for `http://get.docker.io/ubuntu` in the instructions above. For example: - sudo sh -c "echo deb http://mirror.yandex.ru/mirrors/docker/ docker main\ + $ sudo sh -c "echo deb http://mirror.yandex.ru/mirrors/docker/ docker main\ > /etc/apt/sources.list.d/docker.list" - sudo apt-get update - sudo apt-get install lxc-docker + $ sudo apt-get update + $ sudo apt-get install lxc-docker diff --git a/docs/sources/installation/windows.md b/docs/sources/installation/windows.md index a5730862ad..ec633508c4 100644 --- a/docs/sources/installation/windows.md +++ b/docs/sources/installation/windows.md @@ -55,7 +55,7 @@ right away. Let's try the “hello world” example. Run - docker run busybox echo hello world + $ docker run busybox echo hello world This will download the small busybox image and print hello world. diff --git a/docs/sources/introduction/working-with-docker.md b/docs/sources/introduction/working-with-docker.md index e76c80cffa..d6bdb2260d 100644 --- a/docs/sources/introduction/working-with-docker.md +++ b/docs/sources/introduction/working-with-docker.md @@ -60,7 +60,7 @@ The `docker` client usage consists of passing a chain of arguments: # Usage: [sudo] docker [option] [command] [arguments] .. # Example: - docker run -i -t ubuntu /bin/bash + $ docker run -i -t ubuntu /bin/bash ### Our first Docker command @@ -70,7 +70,7 @@ version` command. # Usage: [sudo] docker version # Example: - docker version + $ docker version This command will not only provide you the version of Docker client you are using, but also the version of Go (the programming language powering @@ -97,7 +97,7 @@ binary: # Usage: [sudo] docker # Example: - docker + $ docker You will get an output with all currently available commands. @@ -116,12 +116,12 @@ Try typing Docker followed with a `[command]` to see the instructions: # Usage: [sudo] docker [command] [--help] # Example: - docker attach + $ docker attach Help outputs . . . Or you can pass the `--help` flag to the `docker` binary. - docker images --help + $ docker images --help You will get an output with all available options: @@ -156,12 +156,12 @@ image is constructed. # Usage: [sudo] docker search [image name] # Example: - docker search nginx + $ docker search nginx NAME DESCRIPTION STARS OFFICIAL TRUSTED - dockerfile/nginx Trusted Nginx (http://nginx.org/) Build 6 [OK] + $ dockerfile/nginx Trusted Nginx (http://nginx.org/) Build 6 [OK] paintedfox/nginx-php5 A docker image for running Nginx with PHP5. 3 [OK] - dockerfiles/django-uwsgi-nginx Dockerfile and configuration files to buil... 2 [OK] + $ dockerfiles/django-uwsgi-nginx dockerfile and configuration files to buil... 2 [OK] . . . > **Note:** To learn more about trusted builds, check out [this]( @@ -174,7 +174,7 @@ Downloading a Docker image is called *pulling*. To do this we hence use the # Usage: [sudo] docker pull [image name] # Example: - docker pull dockerfile/nginx + $ docker pull dockerfile/nginx Pulling repository dockerfile/nginx 0ade68db1d05: Pulling dependent layers @@ -193,12 +193,12 @@ In order to get a full list of available images, you can use the # Usage: [sudo] docker images # Example: - docker images + $ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE myUserName/nginx latest a0d6c70867d2 41 seconds ago 578.8 MB nginx latest 173c2dd28ab2 3 minutes ago 578.8 MB - dockerfile/nginx latest 0ade68db1d05 3 weeks ago 578.8 MB + $ dockerfile/nginx latest 0ade68db1d05 3 weeks ago 578.8 MB ## Working with containers @@ -215,7 +215,7 @@ The easiest way to create a new container is to *run* one from an image. # Usage: [sudo] docker run [arguments] .. # Example: - docker run -d --name nginx_web nginx /usr/sbin/nginx + $ docker run -d --name nginx_web nginx /usr/sbin/nginx This will create a new container from an image called `nginx` which will launch the command `/usr/sbin/nginx` when the container is run. We've @@ -242,10 +242,10 @@ both running and stopped. # Usage: [sudo] docker ps [-a] # Example: - docker ps + $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES - 842a50a13032 dockerfile/nginx:latest nginx 35 minutes ago Up 30 minutes 0.0.0.0:80->80/tcp nginx_web + 842a50a13032 $ dockerfile/nginx:latest nginx 35 minutes ago Up 30 minutes 0.0.0.0:80->80/tcp nginx_web ### Stopping a container @@ -254,7 +254,7 @@ end the active process. # Usage: [sudo] docker stop [container ID] # Example: - docker stop nginx_web + $ docker stop nginx_web nginx_web If the `docker stop` command succeeds it will return the name of @@ -266,7 +266,7 @@ Stopped containers can be started again. # Usage: [sudo] docker start [container ID] # Example: - docker start nginx_web + $ docker start nginx_web nginx_web If the `docker start` command succeeds it will return the name of the @@ -358,7 +358,7 @@ Docker uses the `Dockerfile` to build images. The build process is initiated by # Use the Dockerfile at the current location # Usage: [sudo] docker build . # Example: - docker build -t="my_nginx_image" . + $ docker build -t="my_nginx_image" . Uploading context 25.09 kB Uploading context @@ -385,7 +385,7 @@ image, here `my_nginx_image`. We can see our new image using the `docker images` command. - docker images + $ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE my_nginx_img latest 626e92c5fab1 57 seconds ago 337.6 MB diff --git a/docs/sources/reference/api/archive/docker_remote_api_v1.4.md b/docs/sources/reference/api/archive/docker_remote_api_v1.4.md index f31f87e55f..2e7e94f7d4 100644 --- a/docs/sources/reference/api/archive/docker_remote_api_v1.4.md +++ b/docs/sources/reference/api/archive/docker_remote_api_v1.4.md @@ -1127,4 +1127,4 @@ stdout and stderr on the same socket. This might change in the future. To enable cross origin requests to the remote api add the flag "–api-enable-cors" when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" --api-enable-cors + $ docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/archive/docker_remote_api_v1.5.md b/docs/sources/reference/api/archive/docker_remote_api_v1.5.md index 1d0b7e203f..08457bfd94 100644 --- a/docs/sources/reference/api/archive/docker_remote_api_v1.5.md +++ b/docs/sources/reference/api/archive/docker_remote_api_v1.5.md @@ -1134,4 +1134,4 @@ stdout and stderr on the same socket. This might change in the future. To enable cross origin requests to the remote api add the flag "–api-enable-cors" when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" --api-enable-cors + $ docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/archive/docker_remote_api_v1.6.md b/docs/sources/reference/api/archive/docker_remote_api_v1.6.md index ebf2843e93..bca09a3a0e 100644 --- a/docs/sources/reference/api/archive/docker_remote_api_v1.6.md +++ b/docs/sources/reference/api/archive/docker_remote_api_v1.6.md @@ -1236,4 +1236,4 @@ stdout and stderr on the same socket. This might change in the future. To enable cross origin requests to the remote api add the flag "–api-enable-cors" when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" --api-enable-cors + $ docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/archive/docker_remote_api_v1.7.md b/docs/sources/reference/api/archive/docker_remote_api_v1.7.md index 0f18e09d0a..818fbba11c 100644 --- a/docs/sources/reference/api/archive/docker_remote_api_v1.7.md +++ b/docs/sources/reference/api/archive/docker_remote_api_v1.7.md @@ -1230,4 +1230,4 @@ stdout and stderr on the same socket. This might change in the future. To enable cross origin requests to the remote api add the flag "–api-enable-cors" when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" --api-enable-cors + $ docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/archive/docker_remote_api_v1.8.md b/docs/sources/reference/api/archive/docker_remote_api_v1.8.md index 53a8e4d7e1..0d2997693c 100644 --- a/docs/sources/reference/api/archive/docker_remote_api_v1.8.md +++ b/docs/sources/reference/api/archive/docker_remote_api_v1.8.md @@ -1276,4 +1276,4 @@ stdout and stderr on the same socket. This might change in the future. To enable cross origin requests to the remote api add the flag "–api-enable-cors" when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" --api-enable-cors + $ docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.10.md b/docs/sources/reference/api/docker_remote_api_v1.10.md index bbf3592cfc..721244b49e 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.10.md +++ b/docs/sources/reference/api/docker_remote_api_v1.10.md @@ -1297,4 +1297,4 @@ stdout and stderr on the same socket. This might change in the future. To enable cross origin requests to the remote api add the flag "–api-enable-cors" when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" --api-enable-cors + $ docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.11.md b/docs/sources/reference/api/docker_remote_api_v1.11.md index ddff4e19d0..ebaa3e6e44 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.11.md +++ b/docs/sources/reference/api/docker_remote_api_v1.11.md @@ -1337,4 +1337,4 @@ stdout and stderr on the same socket. This might change in the future. To enable cross origin requests to the remote api add the flag "–api-enable-cors" when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" --api-enable-cors + $ docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/docker_remote_api_v1.9.md b/docs/sources/reference/api/docker_remote_api_v1.9.md index bc62b20ac4..d8be62a7a7 100644 --- a/docs/sources/reference/api/docker_remote_api_v1.9.md +++ b/docs/sources/reference/api/docker_remote_api_v1.9.md @@ -1313,4 +1313,4 @@ stdout and stderr on the same socket. This might change in the future. To enable cross origin requests to the remote api add the flag "–api-enable-cors" when running docker in daemon mode. - docker -d -H="192.168.1.9:4243" --api-enable-cors + $ docker -d -H="192.168.1.9:4243" --api-enable-cors diff --git a/docs/sources/reference/api/registry_index_spec.md b/docs/sources/reference/api/registry_index_spec.md index fb5617d101..93ba469221 100644 --- a/docs/sources/reference/api/registry_index_spec.md +++ b/docs/sources/reference/api/registry_index_spec.md @@ -111,7 +111,7 @@ supports: It's possible to run: - docker pull https:///repositories/samalba/busybox + $ docker pull https:///repositories/samalba/busybox In this case, Docker bypasses the Index. However the security is not guaranteed (in case Registry A is corrupted) because there won't be any diff --git a/docs/sources/reference/builder.md b/docs/sources/reference/builder.md index 3e278425c2..98e9e0f544 100644 --- a/docs/sources/reference/builder.md +++ b/docs/sources/reference/builder.md @@ -18,7 +18,7 @@ This file will describe the steps to assemble the image. Then call `docker build` with the path of you source repository as argument (for example, `.`): - sudo docker build . + $ sudo docker build . The path to the source repository defines where to find the *context* of the build. The build is run by the Docker daemon, not by the CLI, so the @@ -28,7 +28,7 @@ whole context must be transferred to the daemon. The Docker CLI reports You can specify a repository and tag at which to save the new image if the build succeeds: - sudo docker build -t shykes/myapp . + $ sudo docker build -t shykes/myapp . The Docker daemon will run your steps one-by-one, committing the result to a new image if necessary, before finally outputting the ID of your diff --git a/docs/sources/reference/commandline/cli.md b/docs/sources/reference/commandline/cli.md index 49e5860ea9..cfcab2af47 100644 --- a/docs/sources/reference/commandline/cli.md +++ b/docs/sources/reference/commandline/cli.md @@ -35,11 +35,11 @@ will set the value to the opposite of the default value. Options like `-a=[]` indicate they can be specified multiple times: - docker run -a stdin -a stdout -a stderr -i -t ubuntu /bin/bash + $ docker run -a stdin -a stdout -a stderr -i -t ubuntu /bin/bash Sometimes this can use a more complex value string, as for `-v`: - docker run -v /host:/container example/mysql + $ docker run -v /host:/container example/mysql ### Strings and Integers @@ -100,10 +100,10 @@ To use lxc as the execution driver, use `docker -d -e lxc`. The docker client will also honor the `DOCKER_HOST` environment variable to set the `-H` flag for the client. - docker -H tcp://0.0.0.0:4243 ps + $ docker -H tcp://0.0.0.0:4243 ps # or - export DOCKER_HOST="tcp://0.0.0.0:4243" - docker ps + $ export DOCKER_HOST="tcp://0.0.0.0:4243" + $ docker ps # both are equal To run the daemon with [systemd socket activation]( @@ -448,7 +448,7 @@ by default. 77af4d6b9913 19 hours ago 1.089 GB committest latest b6fa739cedf5 19 hours ago 1.089 GB 78a85c484f71 19 hours ago 1.089 GB - docker latest 30557a29d5ab 20 hours ago 1.089 GB + $ docker latest 30557a29d5ab 20 hours ago 1.089 GB 0124422dd9f9 20 hours ago 1.089 GB 18ad6fad3402 22 hours ago 1.082 GB f9f1e26352f0 23 hours ago 1.089 GB @@ -462,7 +462,7 @@ by default. 77af4d6b9913e693e8d0b4b294fa62ade6054e6b2f1ffb617ac955dd63fb0182 19 hours ago 1.089 GB committest latest b6fa739cedf5ea12a620a439402b6004d057da800f91c7524b5086a5e4749c9f 19 hours ago 1.089 GB 78a85c484f71509adeaace20e72e941f6bdd2b25b4c75da8693efd9f61a37921 19 hours ago 1.089 GB - docker latest 30557a29d5abc51e5f1d5b472e79b7e296f595abcf19fe6b9199dbbc809c6ff4 20 hours ago 1.089 GB + $ docker latest 30557a29d5abc51e5f1d5b472e79b7e296f595abcf19fe6b9199dbbc809c6ff4 20 hours ago 1.089 GB 0124422dd9f9cf7ef15c0617cda3931ee68346455441d66ab8bdc5b05e9fdce5 20 hours ago 1.089 GB 18ad6fad340262ac2a636efd98a6d1f0ea775ae3d45240d3418466495a19a81b 22 hours ago 1.082 GB f9f1e26352f0a3ba6a0ff68167559f64f3e21ff7ada60366e2d44a04befd1d3a 23 hours ago 1.089 GB @@ -640,7 +640,7 @@ If you want to login to a private registry you can specify this by adding the server name. example: - docker login localhost:8080 + $ docker login localhost:8080 ## logs diff --git a/docs/sources/reference/run.md b/docs/sources/reference/run.md index 9de08ec1a6..a8acb97071 100644 --- a/docs/sources/reference/run.md +++ b/docs/sources/reference/run.md @@ -22,7 +22,7 @@ running containers, and so here we try to give more in-depth guidance. As you`ve seen in the [*Examples*](/examples/#example-list), the basic run command takes this form: - docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...] + $ docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...] To learn how to interpret the types of `[OPTIONS]`, see [*Option types*](/commandline/cli/#cli-options). @@ -99,7 +99,7 @@ https://github.com/dotcloud/docker/blob/ of the three standard streams (`stdin`, `stdout`, `stderr`) you'd like to connect instead, as in: - docker run -a stdin -a stdout -i -t ubuntu /bin/bash + $ docker run -a stdin -a stdout -i -t ubuntu /bin/bash For interactive processes (like a shell) you will typically want a tty as well as persistent standard input (`stdin`), so you'll use `-i -t` together in most @@ -233,7 +233,7 @@ Dockerfile instruction and how the operator can override that setting. Recall the optional `COMMAND` in the Docker commandline: - docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...] + $ docker run [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...] This command is optional because the person who created the `IMAGE` may have already provided a default `COMMAND` using the Dockerfile `CMD`. As the @@ -259,12 +259,12 @@ runtime by using a string to specify the new `ENTRYPOINT`. Here is an example of how to run a shell in a container that has been set up to automatically run something else (like `/usr/bin/redis-server`): - docker run -i -t --entrypoint /bin/bash example/redis + $ docker run -i -t --entrypoint /bin/bash example/redis or two examples of how to pass more parameters to that ENTRYPOINT: - docker run -i -t --entrypoint /bin/bash example/redis -c ls -l - docker run -i -t --entrypoint /usr/bin/redis-cli example/redis --help + $ docker run -i -t --entrypoint /bin/bash example/redis -c ls -l + $ docker run -i -t --entrypoint /usr/bin/redis-cli example/redis --help ## EXPOSE (Incoming Ports) @@ -335,7 +335,7 @@ container running Redis: # The redis-name container exposed port 6379 $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES - 4241164edf6f dockerfiles/redis:latest /redis-stable/src/re 5 seconds ago Up 4 seconds 6379/tcp redis-name + 4241164edf6f $ dockerfiles/redis:latest /redis-stable/src/re 5 seconds ago Up 4 seconds 6379/tcp redis-name # Note that there are no public ports exposed since we didn᾿t use -p or -P $ docker port 4241164edf6f 6379 diff --git a/docs/sources/use/ambassador_pattern_linking.md b/docs/sources/use/ambassador_pattern_linking.md index a04dbdffc0..2bdd434f6e 100644 --- a/docs/sources/use/ambassador_pattern_linking.md +++ b/docs/sources/use/ambassador_pattern_linking.md @@ -146,7 +146,7 @@ remote IP and port - in this case `192.168.1.52:6379`. # then to run it (on the host that has the real backend on it) # docker run -t -i -link redis:redis -name redis_ambassador -p 6379:6379 ambassador # on the remote host, you can set up another ambassador - # docker run -t -i -name redis_ambassador -expose 6379 sh + # docker run -t -i -name redis_ambassador -expose 6379 sh FROM docker-ut MAINTAINER SvenDowideit@home.org.au diff --git a/docs/sources/use/basics.md b/docs/sources/use/basics.md index b9d52877e4..ee3eeabd9d 100644 --- a/docs/sources/use/basics.md +++ b/docs/sources/use/basics.md @@ -10,7 +10,7 @@ This guide assumes you have a working installation of Docker. To check your Docker install, run the following command: # Check that you have a working install - docker info + $ docker info If you get `docker: command not found` or something like `/var/lib/docker/repositories: permission denied` @@ -23,7 +23,7 @@ for installation instructions. ## Download a pre-built image # Download an ubuntu image - sudo docker pull ubuntu + $ sudo docker pull ubuntu This will find the `ubuntu` image by name on [*Docker.io*](../workingwithrepository/#find-public-images-on-dockerio) and @@ -46,7 +46,7 @@ cache. # To detach the tty without exiting the shell, # use the escape sequence Ctrl-p + Ctrl-q # note: This will continue to exist in a stopped state once exited (see "docker ps -a") - sudo docker run -i -t ubuntu /bin/bash + $ sudo docker run -i -t ubuntu /bin/bash ## Bind Docker to another host/port or a Unix socket @@ -87,70 +87,70 @@ when no `-H` was passed in. `host[:port]` or `:port` # Run docker in daemon mode - sudo /docker -H 0.0.0.0:5555 -d & + $ sudo /docker -H 0.0.0.0:5555 -d & # Download an ubuntu image - sudo docker -H :5555 pull ubuntu + $ sudo docker -H :5555 pull ubuntu You can use multiple `-H`, for example, if you want to listen on both TCP and a Unix socket # Run docker in daemon mode - sudo /docker -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock -d & + $ sudo /docker -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock -d & # Download an ubuntu image, use default Unix socket - sudo docker pull ubuntu + $ sudo docker pull ubuntu # OR use the TCP port - sudo docker -H tcp://127.0.0.1:4243 pull ubuntu + $ sudo docker -H tcp://127.0.0.1:4243 pull ubuntu ## Starting a long-running worker process # Start a very useful long-running process - JOB=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo Hello world; sleep 1; done") + $ JOB=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo Hello world; sleep 1; done") # Collect the output of the job so far - sudo docker logs $JOB + $ sudo docker logs $JOB # Kill the job - sudo docker kill $JOB + $ sudo docker kill $JOB ## Listing containers - sudo docker ps # Lists only running containers - sudo docker ps -a # Lists all containers + $ sudo docker ps # Lists only running containers + $ sudo docker ps -a # Lists all containers ## Controlling containers # Start a new container - JOB=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo Hello world; sleep 1; done") + $ JOB=$(sudo docker run -d ubuntu /bin/sh -c "while true; do echo Hello world; sleep 1; done") # Stop the container - docker stop $JOB + $ docker stop $JOB # Start the container - docker start $JOB + $ docker start $JOB # Restart the container - docker restart $JOB + $ docker restart $JOB # SIGKILL a container - docker kill $JOB + $ docker kill $JOB # Remove a container - docker stop $JOB # Container must be stopped to remove it - docker rm $JOB + $ docker stop $JOB # Container must be stopped to remove it + $ docker rm $JOB ## Bind a service on a TCP port # Bind port 4444 of this container, and tell netcat to listen on it - JOB=$(sudo docker run -d -p 4444 ubuntu:12.10 /bin/nc -l 4444) + $ JOB=$(sudo docker run -d -p 4444 ubuntu:12.10 /bin/nc -l 4444) # Which public port is NATed to my container? - PORT=$(sudo docker port $JOB 4444 | awk -F: '{ print $2 }') + $ PORT=$(sudo docker port $JOB 4444 | awk -F: '{ print $2 }') # Connect to the public port - echo hello world | nc 127.0.0.1 $PORT + $ echo hello world | nc 127.0.0.1 $PORT # Verify that the network connection worked - echo "Daemon received: $(sudo docker logs $JOB)" + $ echo "Daemon received: $(sudo docker logs $JOB)" ## Committing (saving) a container state @@ -163,10 +163,10 @@ will be stored (as a diff). See which images you already have using the `docker images` command. # Commit your container to a new named image - sudo docker commit + $ sudo docker commit # List your containers - sudo docker images + $ sudo docker images You now have a image state from which you can create new instances. diff --git a/docs/sources/use/chef.md b/docs/sources/use/chef.md index 5145107a38..897c2b429a 100644 --- a/docs/sources/use/chef.md +++ b/docs/sources/use/chef.md @@ -43,7 +43,7 @@ The next step is to pull a Docker image. For this, we have a resource: This is equivalent to running: - docker pull samalba/docker-registry + $ docker pull samalba/docker-registry There are attributes available to control how long the cookbook will allow for downloading (5 minute default). @@ -68,7 +68,7 @@ managed by Docker. This is equivalent to running the following command, but under upstart: - docker run --detach=true --publish='5000:5000' --env='SETTINGS_FLAVOR=local' --volume='/mnt/docker:/docker-storage' samalba/docker-registry + $ docker run --detach=true --publish='5000:5000' --env='SETTINGS_FLAVOR=local' --volume='/mnt/docker:/docker-storage' samalba/docker-registry The resources will accept a single string or an array of values for any docker flags that allow multiple values. diff --git a/docs/sources/use/networking.md b/docs/sources/use/networking.md index 2249ca42cd..00d0684256 100644 --- a/docs/sources/use/networking.md +++ b/docs/sources/use/networking.md @@ -84,7 +84,7 @@ In this scenario: inet addr:192.168.227.1 Bcast:192.168.227.255 Mask:255.255.255.0 # Run a container - $ docker run -i -t base /bin/bash + docker run -i -t base /bin/bash # Container IP in the 192.168.227/24 range root@261c272cd7d5:/# ifconfig eth0 diff --git a/docs/sources/use/port_redirection.md b/docs/sources/use/port_redirection.md index ef0e644ace..9f2ce98eae 100644 --- a/docs/sources/use/port_redirection.md +++ b/docs/sources/use/port_redirection.md @@ -11,7 +11,7 @@ port. When this service runs inside a container, one can connect to the port after finding the IP address of the container as follows: # Find IP address of container with ID - docker inspect | grep IPAddress | cut -d '"' -f 4 + $ docker inspect | grep IPAddress | cut -d '"' -f 4 However, this IP address is local to the host system and the container port is not reachable by the outside world. Furthermore, even if the @@ -40,7 +40,7 @@ To bind a port of the container to a specific interface of the host system, use the `-p` parameter of the `docker run` command: # General syntax - docker run -p [([:[host_port]])|():][/udp] + $ docker run -p [([:[host_port]])|():][/udp] When no host interface is provided, the port is bound to all available interfaces of the host machine (aka INADDR_ANY, or 0.0.0.0). When no @@ -48,32 +48,32 @@ host port is provided, one is dynamically allocated. The possible combinations of options for TCP port are the following: # Bind TCP port 8080 of the container to TCP port 80 on 127.0.0.1 of the host machine. - docker run -p 127.0.0.1:80:8080 + $ docker run -p 127.0.0.1:80:8080 # Bind TCP port 8080 of the container to a dynamically allocated TCP port on 127.0.0.1 of the host machine. - docker run -p 127.0.0.1::8080 + $ docker run -p 127.0.0.1::8080 # Bind TCP port 8080 of the container to TCP port 80 on all available interfaces of the host machine. - docker run -p 80:8080 + $ docker run -p 80:8080 # Bind TCP port 8080 of the container to a dynamically allocated TCP port on all available interfaces of the host machine. - docker run -p 8080 + $ docker run -p 8080 UDP ports can also be bound by adding a trailing `/udp`. All the combinations described for TCP work. Here is only one example: # Bind UDP port 5353 of the container to UDP port 53 on 127.0.0.1 of the host machine. - docker run -p 127.0.0.1:53:5353/udp + $ docker run -p 127.0.0.1:53:5353/udp The command `docker port` lists the interface and port on the host machine bound to a given container port. It is useful when using dynamically allocated ports: # Bind to a dynamically allocated port - docker run -p 127.0.0.1::8080 --name dyn-bound + $ docker run -p 127.0.0.1::8080 --name dyn-bound # Lookup the actual port - docker port dyn-bound 8080 + $ docker port dyn-bound 8080 127.0.0.1:49160 ## Linking a container @@ -99,24 +99,24 @@ exposure is done either through the `--expose` parameter to the `docker run` command, or the `EXPOSE` build command in a Dockerfile: # Expose port 80 - docker run --expose 80 --name server + $ docker run --expose 80 --name server The `client` then links to the `server`: # Link - docker run --name client --link server:linked-server + $ docker run --name client --link server:linked-server `client` locally refers to `server` as `linked-server`. The following environment variables, among others, are available on `client`: # The default protocol, ip, and port of the service running in the container - LINKED-SERVER_PORT=tcp://172.17.0.8:80 + $ LINKED-SERVER_PORT=tcp://172.17.0.8:80 # A specific protocol, ip, and port of various services - LINKED-SERVER_PORT_80_TCP=tcp://172.17.0.8:80 - LINKED-SERVER_PORT_80_TCP_PROTO=tcp - LINKED-SERVER_PORT_80_TCP_ADDR=172.17.0.8 - LINKED-SERVER_PORT_80_TCP_PORT=80 + $ LINKED-SERVER_PORT_80_TCP=tcp://172.17.0.8:80 + $ LINKED-SERVER_PORT_80_TCP_PROTO=tcp + $ LINKED-SERVER_PORT_80_TCP_ADDR=172.17.0.8 + $ LINKED-SERVER_PORT_80_TCP_PORT=80 This tells `client` that a service is running on port 80 of `server` and that `server` is accessible at the IP address 172.17.0.8 diff --git a/docs/sources/use/puppet.md b/docs/sources/use/puppet.md index c1ac95f4ab..a0d20ab446 100644 --- a/docs/sources/use/puppet.md +++ b/docs/sources/use/puppet.md @@ -23,7 +23,7 @@ The module is available on the [Puppet Forge](https://forge.puppetlabs.com/garethr/docker/) and can be installed using the built-in module tool. - puppet module install garethr/docker + $ puppet module install garethr/docker It can also be found on [GitHub](https://github.com/garethr/garethr-docker) if you would @@ -47,7 +47,7 @@ defined type which can be used like so: This is equivalent to running: - docker pull ubuntu + $ docker pull ubuntu Note that it will only be downloaded if an image of that name does not already exist. This is downloading a large binary so on first run can @@ -71,7 +71,7 @@ managed by Docker. This is equivalent to running the following command, but under upstart: - docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done" + $ docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done" Run also contains a number of optional parameters: diff --git a/docs/sources/use/working_with_volumes.md b/docs/sources/use/working_with_volumes.md index 5817309e62..c403532bcc 100644 --- a/docs/sources/use/working_with_volumes.md +++ b/docs/sources/use/working_with_volumes.md @@ -50,8 +50,8 @@ not. Or, you can use the VOLUME instruction in a Dockerfile to add one or more new volumes to any container created from that image: - # BUILD-USING: docker build -t data . - # RUN-USING: docker run -name DATA data + # BUILD-USING: $ docker build -t data . + # RUN-USING: $ docker run -name DATA data FROM busybox VOLUME ["/var/volume1", "/var/volume2"] CMD ["/bin/true"] @@ -108,7 +108,7 @@ For example: # Usage: # sudo docker run [OPTIONS] -v /(dir. on host):/(dir. in container):(Read-Write or Read-Only) [ARG..] # Example: - sudo docker run -i -t -v /var/log:/logs_from_host:ro ubuntu bash + $ sudo docker run -i -t -v /var/log:/logs_from_host:ro ubuntu bash The command above mounts the host directory `/var/log` into the container with *read only* permissions as `/logs_from_host`. diff --git a/docs/sources/use/workingwithrepository.md b/docs/sources/use/workingwithrepository.md index e3daf05fc7..07f130a909 100644 --- a/docs/sources/use/workingwithrepository.md +++ b/docs/sources/use/workingwithrepository.md @@ -109,7 +109,7 @@ share one of your own images, then you must register a unique user name first. You can create your username and login on [Docker.io](https://index.docker.io/account/signup/), or by running - sudo docker login + $ sudo docker login This will prompt you for a username, which will become a public namespace for your public repositories. @@ -199,10 +199,10 @@ identify a host), like this: # Tag to create a repository with the full registry location. # The location (e.g. localhost.localdomain:5000) becomes # a permanent part of the repository name - sudo docker tag 0u812deadbeef localhost.localdomain:5000/repo_name + $ sudo docker tag 0u812deadbeef localhost.localdomain:5000/repo_name # Push the new repository to its home location on localhost - sudo docker push localhost.localdomain:5000/repo_name + $ sudo docker push localhost.localdomain:5000/repo_name Once a repository has your registry's host name as part of the tag, you can push and pull it like any other repository, but it will **not** be