{"modulePath":"github.com/hostinger/api-cli","version":"v1.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package docker\n\n## Variables\n\n```go\nvar ContainersCmd = \u0026cobra.Command{\n\tUse:   \"containers \u003cvirtual-machine-id\u003e \u003cproject-name\u003e\",\n\tShort: \"Get project containers\",\n\tLong:  \"Retrieves a list of all containers belonging to a specific Docker Compose project on the virtual machine. \\n\\nThis endpoint returns detailed information about each container including\\ntheir current status, port mappings, and runtime configuration.\\n\\nUse this to monitor the health and state of all services within your Docker Compose project.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSGetProjectContainersV1WithResponse(context.TODO(), utils.StringToInt(args[0]), args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar CreateCmd = \u0026cobra.Command{\n\tUse:   \"create \u003cvirtual-machine-id\u003e\",\n\tShort: \"Create new project\",\n\tLong:  \"Deploy new project from docker-compose.yaml contents or download contents from URL. \\n\\nURL can be Github repository url in format https://github.com/[user]/[repo]\\nand it will be automatically resolved to docker-compose.yaml file in\\nmaster branch. Any other URL provided must return docker-compose.yaml\\nfile contents.\\n\\nIf project with the same name already exists, existing project will be replaced.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(1)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tpayload, err := json.Marshal(createBody(cmd))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tr, err := api.Request().VPSCreateNewProjectV1WithBodyWithResponse(context.TODO(), utils.StringToInt(args[0]), \"application/json\", bytes.NewReader(payload))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar DeleteCmd = \u0026cobra.Command{\n\tUse:   \"delete \u003cvirtual-machine-id\u003e \u003cproject-name\u003e\",\n\tShort: \"Delete project\",\n\tLong:  \"Completely removes a Docker Compose project from the virtual machine, stopping all containers and cleaning up \\nassociated resources including networks, volumes, and images. \\n\\nThis operation is irreversible and will delete all project data. \\n\\nUse this when you want to permanently remove a project and free up system resources.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSDeleteProjectV1WithResponse(context.TODO(), utils.StringToInt(args[0]), args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar GetCmd = \u0026cobra.Command{\n\tUse:   \"get \u003cvirtual-machine-id\u003e \u003cproject-name\u003e\",\n\tShort: \"Get project contents\",\n\tLong:  \"Retrieves the complete project information including the docker-compose.yml\\nfile contents, project metadata, and current deployment status.\\n\\nThis endpoint provides the full configuration and state details of a specific Docker Compose project. \\n\\nUse this to inspect project settings, review the compose file, or check the overall project health.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSGetProjectContentsV1WithResponse(context.TODO(), utils.StringToInt(args[0]), args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar GroupCmd = \u0026cobra.Command{\n\tUse:   \"docker\",\n\tShort: \"Docker Manager commands\",\n}\n```\n\n```go\nvar ListCmd = \u0026cobra.Command{\n\tUse:   \"list \u003cvirtual-machine-id\u003e\",\n\tShort: \"Get project list\",\n\tLong:  \"Retrieves a list of all Docker Compose projects currently deployed on the virtual machine. \\n\\nThis endpoint returns basic information about each project including name,\\nstatus, file path and list of containers with details about their names,\\nimage, status, health and ports. Container stats are omitted in this\\nendpoint. If you need to get detailed information about container with\\nstats included, use the `Get project containers` endpoint.\\n\\nUse this to get an overview of all Docker projects on your VPS instance.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(1)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSGetProjectListV1WithResponse(context.TODO(), utils.StringToInt(args[0]))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar LogsCmd = \u0026cobra.Command{\n\tUse:   \"logs \u003cvirtual-machine-id\u003e \u003cproject-name\u003e\",\n\tShort: \"Get project logs\",\n\tLong:  \"Retrieves aggregated log entries from all services within a Docker Compose project. \\n\\nThis endpoint returns recent log output from each container, organized by service name with timestamps. \\nThe response contains the last 300 log entries across all services. \\n\\nUse this for debugging, monitoring application behavior, and\\ntroubleshooting issues across your entire project stack.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSGetProjectLogsV1WithResponse(context.TODO(), utils.StringToInt(args[0]), args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar RestartCmd = \u0026cobra.Command{\n\tUse:   \"restart \u003cvirtual-machine-id\u003e \u003cproject-name\u003e\",\n\tShort: \"Restart project\",\n\tLong:  \"Restarts all services in a Docker Compose project by stopping and starting\\ncontainers in the correct dependency order.\\n\\nThis operation preserves data volumes and network configurations while refreshing the running containers. \\n\\nUse this to apply configuration changes or recover from service failures.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSRestartProjectV1WithResponse(context.TODO(), utils.StringToInt(args[0]), args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar StartCmd = \u0026cobra.Command{\n\tUse:   \"start \u003cvirtual-machine-id\u003e \u003cproject-name\u003e\",\n\tShort: \"Start project\",\n\tLong:  \"Starts all services in a Docker Compose project that are currently stopped. \\n\\nThis operation brings up containers in the correct dependency order as defined in the compose file. \\n\\nUse this to resume a project that was previously stopped or to start services after a system reboot.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSStartProjectV1WithResponse(context.TODO(), utils.StringToInt(args[0]), args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar StopCmd = \u0026cobra.Command{\n\tUse:   \"stop \u003cvirtual-machine-id\u003e \u003cproject-name\u003e\",\n\tShort: \"Stop project\",\n\tLong:  \"Stops all running services in a Docker Compose project while preserving\\ncontainer configurations and data volumes.\\n\\nThis operation gracefully shuts down containers in reverse dependency order. \\n\\nUse this to temporarily halt a project without removing data or configurations.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSStopProjectV1WithResponse(context.TODO(), utils.StringToInt(args[0]), args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar UpdateCmd = \u0026cobra.Command{\n\tUse:   \"update \u003cvirtual-machine-id\u003e \u003cproject-name\u003e\",\n\tShort: \"Update project\",\n\tLong:  \"Updates a Docker Compose project by pulling the latest image versions and\\nrecreating containers with new configurations.\\n\\nThis operation preserves data volumes while applying changes from the compose file. \\n\\nUse this to deploy application updates, apply configuration changes, or\\nrefresh container images to their latest versions.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(2)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSUpdateProjectV1WithResponse(context.TODO(), utils.StringToInt(args[0]), args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n","path":"github.com/hostinger/api-cli/cmd/vps/docker","name":"docker","synopsis":"","isRedistributable":true}
