Both sides previous revisionPrevious revisionNext revision | Previous revision |
docker_cheat_sheet [2021/11/03 21:00] – [Getting Started] stephen | docker_cheat_sheet [2021/11/04 23:01] (current) – external edit 127.0.0.1 |
---|
===== Getting Started ===== | ===== Getting Started ===== |
| |
| ''<nowiki>docker run --name repo alpine/git clone https://github.com/docker/getting-started.git</nowiki>'' | Clone | | | ''<nowiki>docker run --name repo alpine/git ` |
| clone https://github.com/docker/getting-started.git</nowiki>'' | Clone | |
| ''<nowiki>docker cp repo:/git/getting-started/ .</nowiki>'' | Clone | | | ''<nowiki>docker cp repo:/git/getting-started/ .</nowiki>'' | Clone | |
| ''<nowiki>cd getting-started</nowiki>'' | | | | ''<nowiki>cd getting-started</nowiki>'' | | |
-e MYSQL_ROOT_PASSWORD=secret ` | -e MYSQL_ROOT_PASSWORD=secret ` |
-e MYSQL_DATABASE=todos ` | -e MYSQL_DATABASE=todos ` |
mysql:5.7</code> | xxx. | | 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. | |
| |
/* | /* |
| ''<nowiki>xxxx</nowiki>'' | xxx. | | | ''<nowiki>xxxx</nowiki>'' | xxx. | |
| | <code>xxxx</code> | Multiline. | |
*/ | */ |