docker

package
v0.0.0-...-1ba308a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright © 2020 Maciej "Cichy" Świderski <mmswiderski@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2020 Maciej "Cichy" Świderski <mmswiderski@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var DockerCmd = &cobra.Command{
	Use:   "d",
	Short: "DinG -> (d)ocker CLI the fun way ",
	Long: `Shortcutted Docker CLI commands.

Wrapper for Docker CLI with compatibility to original Docker CLI
with some syntactic sugar for ease of use.`,
	Run: func(cmd *cobra.Command, args []string) {
		cmd.Usage()
	},
}
View Source
var PsCmd = &cobra.Command{
	Use:   "ps [grep-like-filter-string]",
	Short: "List containers - fun way " + helpers.GlassesOfDisapproval(),
	Long:  `[=== TODO ===]`,
	Args:  cobra.MaximumNArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		stype := types.ContainerListOptions{}
		stype.All = true
		containers, err := dockerCli.ContainerList(contextBackground, stype)
		if err != nil {
			panic(err)
		}
		table := tablewriter.NewWriter(os.Stdout)
		table.SetHeader([]string{"ID", "NAME", "IMAGE", "STATE"})
		table.SetBorder(false)
		host, _ := os.Hostname()
		table.SetCaption(true, "Running containers on: "+host)
		b, _ := json.Marshal(containers[0])
		logrus.Info(string(b))
		for _, container := range containers {
			table.Append([]string{container.ID[0:6], strings.TrimLeft(strings.Join(container.Names, "\n"), "/"), container.Image, container.State})
		}
		table.Render()
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL