|
|
|
## Introduction
|
|
|
|
|
|
|
|
Portainer is a management solution for Docker. It consists of a web UI that allows you to manage your Docker containers, images, networks and volumes.
|
|
|
|
|
|
|
|
## Accessing Portainer
|
|
|
|
|
|
|
|
1. Go to https://portainer.commerce.gov/
|
|
|
|
1. Authenticate with your GitLab account
|
|
|
|
1. When requested, allow Portainer to access to your GitLab account
|
|
|
|
1. Click on Containers in the left-hand navigation
|
|
|
|
1. Locate your container by name. Keep in mind it will likely have a prefix like websol-d8_.
|
|
|
|
* Example: `websol-d8_stan-docdrupal8-213-commerce8_1`
|
|
|
|
* Site would then be here: https://stan-docdrupal8-213-commerce8.d.commerce.gov/
|
|
|
|
1. Click on the link to see more information on your container
|
|
|
|
1. From here you can do any number of things including check on the container health, restart it, recreate it, access the console as root, see the log files, etc
|
|
|
|
|
|
|
|
## Access Command Line in the Container
|
|
|
|
|
|
|
|
1. Once you have located and gotten access to Portainer, the next step is to click on the `>_ Console` link: 
|
|
|
|
|
|
|
|
1. Click connect
|
|
|
|
|
|
|
|
## Run Drush Commands
|
|
|
|
|
|
|
|
1. Follow the steps to access the command line in the container.
|
|
|
|
1. Navigate to your site’s directory with the following command: `cd /var/www/docker_platform/web/`
|
|
|
|
1. From here you can execute any number of drush commands that you would typically do in your local machine. Common ones include:
|
|
|
|
* Reset admin pw: `drush uli`
|
|
|
|
* Create a new user and set password: `drush user-create newuser --mail="person@example.com" --password="letmein"`
|
|
|
|
* Get a list of users: `drush uinf`
|
|
|
|
* Set permissions for a user `drush user-add-role "administrator" --name= newuser`
|
|
|
|
* Rebuild the cache `drush cr`
|
|
|
|
|
|
|
|
## Run Composer Commands
|
|
|
|
|
|
|
|
1. Follow the steps to access the command line in the container.
|
|
|
|
1. Navigate to your site’s composer location with the following command: `cd /var/www/docker_platform/`
|
|
|
|
1. From here you can execute any number of composer commands. Common ones include:
|
|
|
|
* Install packages defined in composer.json: `composer install`
|
|
|
|
* Update packages defined in composer.json: `composer update`
|
|
|
|
|
|
|
|
## Run MySQL Commands
|
|
|
|
|
|
|
|
1. Follow the steps to access the command line in the container.
|
|
|
|
1. Get the login information from your site’s directory by executing this command: `cat /var/www/docker_platform/web/sites/default/settings.php `
|
|
|
|
1. Locate the information you need from database, username, and password parameters. See screenshot below.
|
|
|
|

|
|
|
|
1. With that information execute the follow command (replacing what is between brackets [])
|
|
|
|
`mysql -u [username] -p [database]`
|
|
|
|
1. Provide the password when prompted.
|
|
|
|
|
|
|
|
Common MySQL Commands include:
|
|
|
|
* See all the tables in the database `show tables;`
|
|
|
|
* See all the values from a table `select * from [table name]`
|
|
|
|
|
|
|
|
## Known Issues
|
|
|
|
|
|
|
|
1. VI or VIM do not work.
|
|
|
|
In this case, use nano. In order to install nano, run the following command:
|
|
|
|
|
|
|
|
`apt-get update && apt-get install -y nano`
|
|
|
|
|
|
|
|
## Set up Portainer on your local
|
|
|
|
```bash
|
|
|
|
docker volume create portainer_data
|
|
|
|
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
|
|
|
|
```
|
|
|
|
|
|
|
|
Tail the installation logs by entering this in your terminal: `docker ps -a` and then get the **hash of the container** to use in the next command: `docker logs --tail all <container hash>`
|
|
|
|
|
|
|
|
After this has completed, you can access your local portainer here: http://localhost:9000/#/images |
|
|
|
\ No newline at end of file |