User Tools

Site Tools


docker_cheat_sheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
docker_cheat_sheet [2021/11/03 21:04] – [Getting Started] stephendocker_cheat_sheet [2021/11/04 23:01] (current) – external edit 127.0.0.1
Line 3: Line 3:
 ===== Getting Started ===== ===== Getting Started =====
  
-| <code>docker run --name repo alpine/git ` +''<nowiki>docker run --name repo alpine/git ` 
-    clone https://github.com/docker/getting-started.git</code> | Clone | +    clone https://github.com/docker/getting-started.git</nowiki>'' | Clone | 
-| <code>docker cp repo:/git/getting-started/ .</code> | Clone | +''<nowiki>docker cp repo:/git/getting-started/ .</nowiki>'' | Clone | 
-| <code>cd getting-started</code> | | +''<nowiki>cd getting-started</nowiki>'' | | 
-| <code>docker build -t docker101tutorial .</code> | Build | +''<nowiki>docker build -t docker101tutorial .</nowiki>'' | Build | 
-| <code>docker run -d -p 80:80 --name docker-tutorial docker101tutorial</code> | Run\\ ''-d'' - run the container in detached mode (in the background)\\ ''-p 80:80'' - map port 80 of the host to port 80 in the container\\ ''docker/getting-started'' - the image to use | +''<nowiki>docker run -d -p 80:80 --name docker-tutorial docker101tutorial</nowiki>'' | Run\\ ''-d'' - run the container in detached mode (in the background)\\ ''-p 80:80'' - map port 80 of the host to port 80 in the container\\ ''docker/getting-started'' - the image to use | 
-| <code>docker ps</code> | List running Docker processes. | +''<nowiki>docker ps</nowiki>'' | List running Docker processes. | 
-| <code>docker stop 6307dc32ab8e</code> | Stop a Docker process. | +''<nowiki>docker stop 6307dc32ab8e</nowiki>'' | Stop a Docker process. | 
-| <code>docker rm 6307dc32ab8e</code> | Delete a Docker process. | +''<nowiki>docker rm 6307dc32ab8e</nowiki>'' | Delete a Docker process. | 
-| <code>docker rm -f 6307dc32ab8e</code> | Stop //and// delete a Docker process.\\ ''-f'' - force | +''<nowiki>docker rm -f 6307dc32ab8e</nowiki>'' | Stop //and// delete a Docker process.\\ ''-f'' - force | 
-| <code>docker exec aab6865570a6 cat /data.txt</code> | Run the ''cat/data.txt'' command inside a running Docker process. | +''<nowiki>docker exec aab6865570a6 cat /data.txt</nowiki>'' | Run the ''cat/data.txt'' command inside a running Docker process. | 
-| <code>docker volume create todo-db</code> | Create a volume called ''todo-db''. | +''<nowiki>docker volume create todo-db</nowiki>'' | Create a volume called ''todo-db''. | 
-| <code>docker network create todo-app</code> | Create a network called ''todo-app''. |+''<nowiki>docker network create todo-app</nowiki>'' | Create a network called ''todo-app''. |
 | <code>docker run -d ` | <code>docker run -d `
     --network todo-app --network-alias mysql `     --network todo-app --network-alias mysql `
Line 22: Line 22:
     -e MYSQL_DATABASE=todos `     -e MYSQL_DATABASE=todos `
     mysql:5.7</code> | Start a MySQL container and attach it to the network. Set a couple of variables. |     mysql:5.7</code> | Start a MySQL container and attach it to the network. Set a couple of variables. |
 +| ''<nowiki>docker exec -it <mysql-container-id> mysql -p</nowiki>'' | Connect to the MySQL database. |
 +| ''<nowiki>docker run -it --network todo-app nicolaka/netshoot</nowiki>'' | Start a new container using the [[https://github.com/nicolaka/netshoot|nicolaka/netshoot]] image. |
 +| ''<nowiki>dig mysql</nowiki>'' | (From inside nicolaka/netshoot) network lookup for the ''mysql'' network. |
 +| ''<nowiki>docker-compose up -d</nowiki>'' | Use Docker Compose to run the application stack defined in the ''docker-compose.yml'' file.\\ ''-d'' - run the container in detached mode (in the background) |
 +| ''<nowiki>docker-compose logs -f</nowiki>'' | See the logs from each of the services interleaved into a single stream. |
 +| ''<nowiki>docker-compose logs -f <service name></nowiki>'' | See the logs for a specific service. |
 +| ''<nowiki>docker-compose down</nowiki>'' | Tear down the application. |
 +| ''<nowiki>docker-compose down --volumes</nowiki>'' | Tear down the application //and// the named volumes. |
 +| ''<nowiki>docker scan <image name></nowiki>'' | Scan an image for vulnerabilities. |
 +| ''<nowiki>docker image history <image name></nowiki>'' | Image history and layers. |
  
 /* /*
-| <code>xxxx</code>xxx. |+| ''<nowiki>xxxx</nowiki>'' | xxx. | 
 +| <code>xxxx</code>Multiline. |
 */ */
docker_cheat_sheet.1635973467.txt.gz · Last modified: 2021/11/04 22:04 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki