Giter Club home page Giter Club logo

docker-commands's Introduction

Essential Docker Commands Every Developer Should Know


It' hard to ignore docker this days if you are a Software Developer. Here I gather the most common docker commands which every developer will need in order to do their job better.


โญ•๏ธ Version | ๐Ÿ“– docs

docker version

To see the Installed Docker version info.

โญ•๏ธ Search | ๐Ÿ“– docs

docker search [name]

Search for specefic images on the Docker Hub. For example if you want to get Neo4j image run:

docker search neo4j

โญ•๏ธ Pull | ๐Ÿ“– docs

docker pull [name]:[TAG]

Pull an image from the Docker Hub

  • [name] is the name for the image. ex: neo4j
  • [TAG] you can sepecify which version of the image you want to pull. If not specified, the latest tag will be used by default.
  • --platform set this option to pull image for the specified platform and OS
  • -a or --all-tags to pull all available tags from the registry
  • -q or --quiet to suppress verbose output

Examples:

docker pull neo4j

this will pull the latest official image for Neo4j.

docker pull --all-tags ubuntu

this will pull all images from ubuntu repository.

docker pull ubuntu:22.04

this will pull a specefic version of ubuntu.

โญ•๏ธ Images | ๐Ÿ“– docs

docker images

This will print a list of all docker images on the local system.

โญ•๏ธ Run | ๐Ÿ“– docs

docker run [name] [command] [args]

Creates and run a new container from an image.

Examples:

docker run neo4j

simply runs the neo4j image in a new container

docker run --name test -it neo4j

run a container named test form neo4j image

โญ•๏ธ PS | ๐Ÿ“– docs

docker ps 

Lists docker running containers. Examples:

docker ps --all

--all or -a list all containers. default just shows running.

docker ps --latest

--latest or -l list the latest created container

โญ•๏ธ Restart | ๐Ÿ“– docs

docker restart [CONTAINER]

restart one or more container.

โญ•๏ธ Kill | ๐Ÿ“– docs

docker kill [CONTAINER]

Kill one or more containers Examples:

docker kill neo4j_imun postgress-UX59

This will kill these 2 containers.

โญ•๏ธ Stop | ๐Ÿ“– docs

docker stop [CONTAINER]

Stop one or more containers.

docker stop -t 10000 Neo4j-98xt

Stops Neo4j container after waiting for a specific time.

โญ•๏ธ Build | ๐Ÿ“– docs

docker build [DockerFilePath]

Build an image from a docker file or docker repository.

โญ•๏ธ Attach | ๐Ÿ“– docs

docker attach [CONTAINER]

Attach your terminal to a running container to control I/O operations.

โญ•๏ธ Exec | ๐Ÿ“– docs

docker exec [CONTAINER] [COMMANDS]

Executes cli commands in a running container.

docker exec ubuntu-76sx touch /tmp/myfile

This will creates a file in ubuntu-76sx container.

docker exec -it ubuntu-76sx sh

This starts a new shell session in the ubuntu-76sx container.

โญ•๏ธ Logs | ๐Ÿ“– docs

docker logs [CONTAINER]

See the logs for a given container.

docker logs --follow ubuntu-76sx

Use --follow or -f for display logs of ubuntu-76sx container and follow the output as the logs continues.

docker logs -f --until=30m neo4j-ex54

this will display logs before a specific point in time.

โญ•๏ธ Commit | ๐Ÿ“– docs

docker commit [CONTAINER] [REPOSITORY]

Create a new image from a container's changes. The new image will not include any data from the container's volumes.

docker commit neo4j-es87 example/test:v4

This will creates a new image from neo4j-es87 container in example/test repository with v4 as its tag. You can use --change options to apply dockerfile instructions to the new image being created.

โญ•๏ธ Compose | ๐Ÿ“– docs

docker compose up -d 

compose command use for create and running multi container docker application and use yaml for configuration application service first open go to directory that docker-compose.yml file is exist then run above command to configuration set for your containers -d command for detach mode


docker-commands's People

Contributors

0r0 avatar imaun avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.