@@ -11,7 +11,7 @@ redirect_from:
11
11
12
12
After you
13
13
[ install Docker] ( /install/index.md ) , you can
14
- [ install the Go and Python SDKs ] ( /develop /sdk/index.md#install-the-sdks ) and
14
+ [ install the Go or Python SDK ] ( /engine/api /sdk/index.md#install-the-sdks ) and
15
15
also try out the Docker Engine API.
16
16
17
17
Each of these examples show how to perform a given Docker operation using the Go
@@ -40,13 +40,14 @@ command prompt:
40
40
package main
41
41
42
42
import (
43
- " os "
43
+ " context "
44
44
" io"
45
+ " os"
46
+
45
47
" github.com/docker/docker/api/types"
46
48
" github.com/docker/docker/api/types/container"
47
- " github.com/docker/docker/pkg/stdcopy"
48
49
" github.com/docker/docker/client"
49
- " golang.org/x/net/context "
50
+ " github.com/docker/docker/pkg/stdcopy "
50
51
)
51
52
52
53
func main () {
@@ -144,14 +145,14 @@ You can also run containers in the background, the equivalent of typing
144
145
package main
145
146
146
147
import (
148
+ " context"
147
149
" fmt"
148
150
" io"
149
151
" os"
150
152
151
153
" github.com/docker/docker/api/types"
152
154
" github.com/docker/docker/api/types/container"
153
155
" github.com/docker/docker/client"
154
- " golang.org/x/net/context"
155
156
)
156
157
157
158
func main () {
@@ -230,11 +231,11 @@ You can use the API to list containers that are running, just like using
230
231
package main
231
232
232
233
import (
234
+ " context"
233
235
" fmt"
234
236
235
237
" github.com/docker/docker/api/types"
236
238
" github.com/docker/docker/client"
237
- " golang.org/x/net/context"
238
239
)
239
240
240
241
func main () {
@@ -306,11 +307,11 @@ This example stops all running containers.
306
307
package main
307
308
308
309
import (
310
+ " context"
309
311
" fmt"
310
312
311
313
" github.com/docker/docker/api/types"
312
314
" github.com/docker/docker/client"
313
- " golang.org/x/net/context"
314
315
)
315
316
316
317
func main () {
@@ -386,12 +387,12 @@ to change the hard-coded ID of the container to print the logs for.
386
387
package main
387
388
388
389
import (
390
+ " context"
389
391
" io"
390
392
" os"
391
393
392
394
" github.com/docker/docker/api/types"
393
395
" github.com/docker/docker/client"
394
- " golang.org/x/net/context"
395
396
)
396
397
397
398
func main () {
@@ -456,11 +457,11 @@ List the images on your Engine, similar to `docker image ls`:
456
457
package main
457
458
458
459
import (
460
+ " context"
459
461
" fmt"
460
462
461
463
" github.com/docker/docker/api/types"
462
464
" github.com/docker/docker/client"
463
- " golang.org/x/net/context"
464
465
)
465
466
466
467
func main () {
@@ -526,12 +527,12 @@ Pull an image, like `docker pull`:
526
527
package main
527
528
528
529
import (
530
+ " context"
529
531
" io"
530
532
" os"
531
533
532
534
" github.com/docker/docker/api/types"
533
535
" github.com/docker/docker/client"
534
- " golang.org/x/net/context"
535
536
)
536
537
537
538
func main () {
@@ -600,14 +601,14 @@ Pull an image, like `docker pull`, with authentication:
600
601
package main
601
602
602
603
import (
604
+ " context"
603
605
" encoding/base64"
604
606
" encoding/json"
605
607
" io"
606
608
" os"
607
609
608
610
" github.com/docker/docker/api/types"
609
611
" github.com/docker/docker/client"
610
- " golang.org/x/net/context"
611
612
)
612
613
613
614
func main () {
@@ -699,12 +700,12 @@ Commit a container to create an image from its contents:
699
700
package main
700
701
701
702
import (
703
+ " context"
702
704
" fmt"
703
705
704
706
" github.com/docker/docker/api/types"
705
707
" github.com/docker/docker/api/types/container"
706
708
" github.com/docker/docker/client"
707
- " golang.org/x/net/context"
708
709
)
709
710
710
711
func main () {
0 commit comments