Lokvin Wiki
Tag: sourceedit
Tag: sourceedit
Line 49: Line 49:
 
$ docker login --username=maryatdocker --password=uydfiad77fad --email=mary@docker.com
 
$ docker login --username=maryatdocker --password=uydfiad77fad --email=mary@docker.com
 
$ docker push maryatdocker/docker-whale
 
$ docker push maryatdocker/docker-whale
  +
  +
=== pull new image ===
  +
* docker rmi
  +
You can use an ID or the name to remove an image.
  +
$ docker rmi -f 7d9495d03763
  +
$ docker rmi -f docker-whale

Revision as of 07:01, 9 September 2015

docker doc

docker begin

  • install docker on mac
  • docker run hello-world
>docker run hello-world
  • docker run docker/whalesay cowsay boo
>docker run docker/whalesay cowsay boo
  • docker images - list all images on your local system
bash-3.2$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
docker-whale        latest              614b79d97fb0        7 days ago          274 MB
yren/docker-whale   latest              614b79d97fb0        7 days ago          274 MB
hello-world         latest              af340544ed62        4 weeks ago         960 B
docker/whalesay     latest              fb434121fc77        3 months ago        247 MB

write a docker file

  • mkdir mydockerbuild
$ mkdir mydockerbuild
$ cd mydockerbuild
$ touch Dockerfile
$vi Dockerfile
  • add blow content to Dockerfile
FROM docker/whalesay:latest
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a | cowsay
  • build your new image by typing the "docker build -t docker-whale ."
 docker build -t docker-whale .

publish image to docker hub

  • tag and publish image
docker images

find image id for "docker-whale"

$ docker tag 7d9495d03763 maryatdocker/docker-whale:latest
$ docker login --username=maryatdocker --password=uydfiad77fad --email=mary@docker.com
$ docker push maryatdocker/docker-whale

pull new image

  • docker rmi

You can use an ID or the name to remove an image.

$ docker rmi -f 7d9495d03763
$ docker rmi -f docker-whale