{"id":17028512,"url":"https://github.com/bennycode/workshop-docker","last_synced_at":"2026-05-08T13:48:33.525Z","repository":{"id":148477710,"uuid":"451878369","full_name":"bennycode/workshop-docker","owner":"bennycode","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-19T08:03:45.000Z","size":43,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-27T23:46:41.668Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bennycode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-01-25T12:59:02.000Z","updated_at":"2022-01-25T14:18:35.000Z","dependencies_parsed_at":"2023-10-03T00:01:10.101Z","dependency_job_id":null,"html_url":"https://github.com/bennycode/workshop-docker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennycode%2Fworkshop-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennycode%2Fworkshop-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennycode%2Fworkshop-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennycode%2Fworkshop-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bennycode","download_url":"https://codeload.github.com/bennycode/workshop-docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245013985,"owners_count":20547178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T07:54:49.859Z","updated_at":"2026-05-08T13:48:33.494Z","avatar_url":"https://github.com/bennycode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# workshop-docker\r\n\r\n## Commands\r\n\r\nLevel 1:\r\n\r\n- `FROM`\r\n- `RUN`\r\n- `WORKDIR`\r\n- `COPY`\r\n- `CMD`\r\n\r\nLevel 2:\r\n\r\n- `ENV`\r\n- `EXPOSE`\r\n- `ENTRYPOINT`\r\n\r\nExamples:\r\n\r\n- Shell Form: `RUN chmod + x ./hello.sh`\r\n- Exec Form: `RUN [\"python\", \"hello.py\"]`\r\n- https://goinbigdata.com/docker-run-vs-cmd-vs-entrypoint/\r\n\r\n## Learnings\r\n\r\n- Docker container will be automatically stopped when there is no infinite command (ex. using a simple command like `console.log` without an infinite loop surrounding it)\r\n\r\n## Images\r\n\r\n### Build Image\r\n\r\n```yml\r\ndocker build .\r\ndocker build -f Dockerfile -t our-server .\r\n```\r\n\r\n### List Images\r\n\r\n```yml\r\ndocker image list\r\ndocker image ls\r\n```\r\n\r\n### Remove Images\r\n\r\n```yml\r\ndocker image rm \u003cREPOSITORY\u003e\r\ndocker rmi \u003cIMAGE ID\u003e\r\n\r\n# Example\r\ndocker image rm lambot-1_tws:latest\r\n```\r\n\r\n## Containers\r\n\r\n### Run Containers\r\n\r\n```yml\r\ndocker run -d \u003cREPOSITORY:TAG\u003e\r\ndocker run -d -p \u003cCONTAINER PORT\u003e:\u003cIMAGE PORT\u003e our-server:latest\r\ndocker run --env-file=.env -d -p 8080:1339 our-server:latest\r\ndocker run --name some-container -e POSTGRES_USER=root -d postgres\r\n\r\n# Example:\r\ndocker run -d our-server:latest\r\ndocker run -d -p 8080:80 our-server:latest\r\n```\r\n\r\n### Show Containers\r\n\r\n```yml\r\n# Show running containers\r\ndocker ps\r\n\r\n# Show all containers (running \u0026 stopped)\r\ndocker ps -a\r\n```\r\n\r\n### View Container Logs\r\n\r\n```yml\r\ndocker logs \u003cCONTAINER NAME\u003e\r\ndocker logs -f \u003cCONTAINER NAME\u003e\r\n```\r\n\r\n### Remove Container\r\n\r\n```yml\r\ndocker rm \u003cCONTAINER ID\u003e\r\n```\r\n\r\n### Publish Images\r\n\r\n- Docker Registries: Docker Hub, GitHub's Docker Registry (https://ghcr.io), Google Container Registry\r\n\r\n```yml\r\ndocker login ghcr.io --username phanatic --password-stdin\r\ndocker tag app ghcr.io/phanatic/app:1.0.0\r\ndocker push ghcr.io/phanatic/app:1.0.0\r\n```\r\n\r\n## Docker Compose\r\n\r\n\u003e [!IMPORTANT]  \r\n\u003e The \"docker-compose\" command belongs to Docker Compose V1\r\n\u003e The \"docker compose\" command belongs to Docker Compose V2\r\n \r\nPreferred syntax is V2:\r\n\r\n```bash\r\ndocker compose --profile dev up -d\r\n```\r\n\r\n### Start Composition\r\n\r\n```yml\r\ndocker-compose up -d\r\ndocker-compose -f docker-compose.yml up -d\r\ndocker-compose -p ninja-workshop up -d\r\ndocker-compose -p ninja-workshop --env-file=.env up -d\r\ndocker-compose -p ninja-workshop --env-file=.env up -d --build # enforce new Image builds\r\ndocker-compose --profile dev up -d\r\n```\r\n\r\n### Terminate Composition\r\n\r\n```yml\r\ndocker-compose -p ninja-workshop down\r\ndocker compose --profile dev down -v\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbennycode%2Fworkshop-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbennycode%2Fworkshop-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbennycode%2Fworkshop-docker/lists"}