Skip to content

Instantly share code, notes, and snippets.

@hr-sadooghi
Last active June 1, 2020 18:14
Show Gist options
  • Save hr-sadooghi/8bb6509822eec14dc6150bc697944e8a to your computer and use it in GitHub Desktop.
Save hr-sadooghi/8bb6509822eec14dc6150bc697944e8a to your computer and use it in GitHub Desktop.
Some useful docker commands for me

https://laradock.io/documentation/

For first time to install and prepare laradock:

For first time use this guide: https://laradock.io/getting-started/

List current running Containers:

docker ps

You can also use the following command if you want to see only this project containers:

docker-compose ps

Close all running Containers

docker-compose stop

To stop single container do:

docker-compose stop {container-name}

Delete all existing Containers

docker-compose down

Enter a Container

Run commands in a running Container.

  1. First list the current running containers with docker ps

  2. Enter any container using:

    docker-compose exec {container-name} bash
    

    Example: enter MySQL container

    docker-compose exec mysql bash
    

    Example: enter to MySQL prompt within MySQL container

    docker-compose exec mysql mysql -udefault -psecret
    
  3. To exit a container, type exit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment